Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Instance variable NSArray

Instance variable NSArray
Thread Tools
Junior Member
Join Date: Sep 2000
Location: Calgary, Alberta, Canada
Status: Offline
Reply With Quote
Apr 18, 2002, 09:15 PM
 
I have an NSArray declared as an instance variable in a controller object that I have, in the object's - (id)init method I call another method that assigns that NSArray an array with the call [staffArray arrayWithObjects:<object1>, <object2>, etc.., nil]. I have one method that obtains objects from this array with no problem, however, I have another method that builds an NSPopUpButton with the contents of this array, and I get a SIGBUS if I don't have the array assigned inside the method that builds the NSPopUpButton. Anybody know why this is?
"The pool on the roof must have a leak"
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 18, 2002, 09:43 PM
 
Originally posted by exrae:
<STRONG>I have an NSArray declared as an instance variable in a controller object that I have, in the object's - (id)init method I call another method that assigns that NSArray an array with the call [staffArray arrayWithObjects:&lt;object1&gt;, &lt;object2&gt;, etc.., nil]. I have one method that obtains objects from this array with no problem, however, I have another method that builds an NSPopUpButton with the contents of this array, and I get a SIGBUS if I don't have the array assigned inside the method that builds the NSPopUpButton. Anybody know why this is?</STRONG>
Are you retaining the array reference? I believe arrayWithObjects returns an NSArray object that's been sent an autorelease message. Therefore, try sending your array a RETAIN message after creating it.

That's my only guess.
F-bacher

[ 04-19-2002: Message edited by: Ghoser777 ]
     
Junior Member
Join Date: Sep 2000
Location: Bremen, Germany
Status: Offline
Reply With Quote
Apr 19, 2002, 12:13 PM
 
Originally posted by Ghoser777:
<STRONG>

Are you retaining the array reference? I believe arrayWithObjects returns an NSArray object that's been sent an autorelease message. Therefore, try sending your array a release message after creating it.

That's my only guess.
F-bacher</STRONG>
You meant retain or ?
"Eine gute Basis ist die Grundlage für ein solides Fundament", Unknown
"If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is", John von Neumann
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 19, 2002, 12:22 PM
 
Yes I did. Whoops. Fixed now.

F-bacher
     
exrae  (op)
Junior Member
Join Date: Sep 2000
Location: Calgary, Alberta, Canada
Status: Offline
Reply With Quote
Apr 19, 2002, 06:50 PM
 
I assumed retain
"The pool on the roof must have a leak"
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:49 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2