• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Totally stumped on extern NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Totally stumped on extern NSString


  • Subject: Re: Totally stumped on extern NSString
  • From: Fritz Anderson <email@hidden>
  • Date: Sat, 7 Jul 2007 20:25:51 -0500


On 7 Jul 2007, at 6:45 PM, William Squires wrote:

- (void)writeToFile:(NSString *) path
{
...
}
+ (void)writeSharedAddressBookToFile
{
// Added as a debug aid..
NSString *localStr = [NSString stringWithString:AddressBookFilePath];
// ...
[[AddressBook sharedAddressBook] writeToFile:localStr];
}
...
@end
(uninteresting parts trimmed for brevity... :) )
...
[The -writeToFile: method fails...]
because path = nil, but when I click on the stack crawl to view the calling method, I can see (in the Globals Browser) that AddressBookFilePath is initialized and has a valid NSString in it! Why is the call losing the NSString pointer value?

If your "interesting parts" demonstrate that there is no bug, and you have a bug, then something is going on in the parts you think are uninteresting. For instance, your excerpts never show AddressBookFilePath being initialized.


I'd break at the first line of -writeSharedAddressBookToFile and try a print-object on AddressBookFilePath (enter 'po AddressBookFilePath' in the debugger console). If it's nil, then you've learned something.

I'd do a global find on AddressBookFilePath, to verify that it is defined only once. I would put a breakpoint on every assignment to AddressBookFilePath, to see the last value it was given.

(You are gate-keeping AddressBookFilePath with accessor methods, aren't you? If so, why are you making the variable globally-accessible?)

I know I'm asking you to do things for which you feel you already know the answers, but if everything is going as you think it should, then you don't have a bug.

	— F

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Totally stumped on extern NSString
      • From: William Squires <email@hidden>
References: 
 >Totally stumped on extern NSString (From: William Squires <email@hidden>)

  • Prev by Date: Re: RS: basic sound tool
  • Next by Date: Re: Core data / bindings with two one->many relationships
  • Previous by thread: Re: Totally stumped on extern NSString
  • Next by thread: Re: Totally stumped on extern NSString
  • Index(es):
    • Date
    • Thread