• 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: Ignoring an empty field in the address book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ignoring an empty field in the address book


  • Subject: Re: Ignoring an empty field in the address book
  • From: Ben Mackin <email@hidden>
  • Date: Fri, 03 Jan 2003 19:05:23 -0800

On 1/3/03 6:37 PM, "Angela Brett" <email@hidden> wrote:

> It looks like you're testing [[peopleFound objectAtIndex:i]
> valueForProperty:kABLastNameProperty] against @"" when it's actually
> nil.

I guess I should have stated that I tried nil also, same result.

> So isEqualToString: would return 0 since it's a message to nil,
> then the code would get to temp3String = [temp2String
> stringByAppendingString:... and try to append that nil string to
> temp2String, which causes that error.

Sounds good, except when I had my NSLog code (again I should have mentioned
this), it never even got to the temp3String = [temp2String
stringByAppendingString:... It stopped before that.

> Try changing that if statement to:
> if ([[peopleFound objectAtIndex:i] valueForProperty:kABLastNameProperty])

Unfortunatly same thing. It stops and says:

[NSCFString stringByAppendingString:]: nil string (or other) argument

It is never making it past [peopleFound objectAtIndex:i]
valueForProperty:kABLastNameProperty]. If I just do the following:

NSLog([peopleFound objectAtIndex:i] valueForProperty:kABLastNameProperty])

It wont do that line (I would have thought it would display an empty string
at least), and reports:

[NSCFString stringByAppendingString:]: nil string (or other) argument

So it is something about checking none existent properties I guess...

> As for the +properties method, it is a class method (note the +) and
> you were sending it to an instance. You should use [ABPerson
> properties] rather than [peopleFound properties]

Doh! I should have realized that. Stupid me :)

Thanks,
Ben

http://www.shayufilms.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Ignoring an empty field in the address book (From: Angela Brett <email@hidden>)

  • Prev by Date: Re: Find out what's wrong with an NSString?
  • Next by Date: Re: Internet programming, point me?
  • Previous by thread: Re: Ignoring an empty field in the address book
  • Next by thread: Re: Ignoring an empty field in the address book (bug?)
  • Index(es):
    • Date
    • Thread