FROM : Bob Peterson
DATE : Sun Dec 19 19:41:09 2004
You were right, I wasn't able to directly alloc and init MyItem. In
fact MyItemList, which is instantiated by MyManager, was getting nil
back.
It turns out I had misconfigured my XCode project when I tried to split
the project into multiple build targets. I rebuilt it, separating each
target's files into separate folders. I made sure there were clearly
separate Info.plist files, and the INFOPLIST_FILE build setting for
each target pointed to the right file.
Thanks for getting me to check for nil. I guess I've been using too
much C# and was forgetting that nil pointers are effectively ignored as
message targets.
\bob
On Dec 18, 2004, at 11:47 PM, mmalcolm crawford wrote:
>
> On Dec 18, 2004, at 7:55 PM, Bob Peterson wrote:
>
>> Is it possible to use bindings across frameworks? I get an error:
>> 2004-12-17 19:51:57.453 MyApp[1667] Cannot find object class with
>> name MyItem
>> It happens when I send an add: action to my NSArrayController. The
>> controller is declared to contain items of type MyItem. The key path
>> winds its way through three model objects: a MyManager, a MyItemList
>> controlled by the NSArrayController, and its MyItems. The MyItemList
>> and MyItem classes are in a separate framework from the main
>> application.
>> When I build the app as a single target (everything built into a
>> single executable, no separate framework), it works. What am I doing
>> wrong?
>>
> When you use the separate framework, can you create a new instance of
> MyItem directly using alloc/init?
>
> If so, the controller may be only looking for the class in the
> application's main bundle? You could try subclassing
> NSArrayController and overriding -newObject:
>
> - newObject
> {
> id newObject = [[MyItem alloc] init];
> // custom initialisation if required
> return newObject;
> }
>
>
> mmalc
DATE : Sun Dec 19 19:41:09 2004
You were right, I wasn't able to directly alloc and init MyItem. In
fact MyItemList, which is instantiated by MyManager, was getting nil
back.
It turns out I had misconfigured my XCode project when I tried to split
the project into multiple build targets. I rebuilt it, separating each
target's files into separate folders. I made sure there were clearly
separate Info.plist files, and the INFOPLIST_FILE build setting for
each target pointed to the right file.
Thanks for getting me to check for nil. I guess I've been using too
much C# and was forgetting that nil pointers are effectively ignored as
message targets.
\bob
On Dec 18, 2004, at 11:47 PM, mmalcolm crawford wrote:
>
> On Dec 18, 2004, at 7:55 PM, Bob Peterson wrote:
>
>> Is it possible to use bindings across frameworks? I get an error:
>> 2004-12-17 19:51:57.453 MyApp[1667] Cannot find object class with
>> name MyItem
>> It happens when I send an add: action to my NSArrayController. The
>> controller is declared to contain items of type MyItem. The key path
>> winds its way through three model objects: a MyManager, a MyItemList
>> controlled by the NSArrayController, and its MyItems. The MyItemList
>> and MyItem classes are in a separate framework from the main
>> application.
>> When I build the app as a single target (everything built into a
>> single executable, no separate framework), it works. What am I doing
>> wrong?
>>
> When you use the separate framework, can you create a new instance of
> MyItem directly using alloc/init?
>
> If so, the controller may be only looking for the class in the
> application's main bundle? You could try subclassing
> NSArrayController and overriding -newObject:
>
> - newObject
> {
> id newObject = [[MyItem alloc] init];
> // custom initialisation if required
> return newObject;
> }
>
>
> mmalc
| Related mails | Author | Date |
|---|---|---|
| Bob Peterson | Dec 19, 04:55 | |
| mmalcolm crawford | Dec 19, 05:47 | |
| Bob Peterson | Dec 19, 19:41 |






Cocoa mail archive

