Re: initWithObject Confusion

2010-04-08 Thread Nick Zitzmann
On Apr 8, 2010, at 5:03 PM, John Nairn wrote: > In Snow Leopard, however, there was no message and it worked fine as if Snow > Leopard read my mind and realized I wanted to create an array with a single > object. But, I am nervous about relying on the OS to read my mind (or even > have an idea

Re: initWithObject Confusion

2010-04-08 Thread John Nairn
On Apr 8, 2010, at 2:10 PM, Kyle Sluder wrote: 2. Even if it compiles, how can it run in Snow Leopard when there is no initWithObject: selector for NSArray (or at least according to the NSArray docmentation there isn't one)? Have you checked your console output? Or there might be a private

Re: initWithObject Confusion

2010-04-08 Thread Kyle Sluder
On Thu, Apr 8, 2010 at 2:05 PM, John Nairn wrote: > 1. Why would the initWithObject: compile in the first place? (perhaps > because one of my custom classes defines an initWithObject: method) Correct. +alloc is typed to return id, which the compiler won't warn about if it has ever seen the method

initWithObject Confusion

2010-04-08 Thread John Nairn
How is this possible? I wrote code in Snow Leopard to create an array with a single object using NSArray *myArray = [ [NSArray alloc] initWithObject:oneObject ] ; and it worked fine. When it crashed in either Leopard or Tiger, I went to NSArray documentation and found out that it does