• 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: Can anyone confirm this IB Bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can anyone confirm this IB Bug?


  • Subject: Re: Can anyone confirm this IB Bug?
  • From: Jonathan Dann <email@hidden>
  • Date: Sun, 3 Aug 2008 00:00:26 +0100


On 2 Aug 2008, at 20:41, Stephane Sudre wrote:


On Aug 2, 2008, at 8:08 PM, Jonathan Dann wrote:

Hi all,

I recently made an IBPlugin for one of my custom controls, which I linked to my own framework. The framework had an NSArray category with the method, -firstObject. When trying to run IB it kept crashing before loading any of my custom control's code, the stack trace showed that my -firstObject method was getting called (and not by me).

Here's my implementation

- (id)firstObject;
{
	return (id)CFArrayGetValueAtIndex((CFArrayRef)self, 0);
}

Which will raise an exception if the array has no elements. What I think was happening is that somewhere in IB or InterfaceBuilderKit a -firstObject method had been defined that returned nil when the array was empty, so when my method was called, the caller was expecting a method that *could* return nil. Am I right in my diagnosis? In my mind such a method should raise for index out of bounds, and I shouldn't insulate myself in framework code from attempting to access out of bounds. It has caused me to refactor a bunch of my code that called my -firstObject method; nothing big, just annoying as I'd used it a lot.

I tend to believe CoreFoundation is not doing a lot of checks. So don't expect exception or check for NULL values.




That's good to know Stephane, thank you.

Jonathan

http://espresso-served-here.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can anyone confirm this IB Bug?
      • From: Kevin Cathey <email@hidden>
References: 
 >Can anyone confirm this IB Bug? (From: Jonathan Dann <email@hidden>)
 >Re: Can anyone confirm this IB Bug? (From: Stephane Sudre <email@hidden>)

  • Prev by Date: Re: Can anyone confirm this IB Bug?
  • Next by Date: Xcode 3.1 alert
  • Previous by thread: Re: Can anyone confirm this IB Bug?
  • Next by thread: Re: Can anyone confirm this IB Bug?
  • Index(es):
    • Date
    • Thread