I'd posted this on the Cocoa dev list, but it turns out its quite QC
specific so I'm asking here.
I've tried loading a plist with the two following routes in the
enableExecution method of a QCPlugin:
NSDictionary *myData = [NSDictionary
dictionaryWithContentsOfFile:@"mydata.plist"];
NSDictionary *myData = [[NSDictionary alloc]
initWithContentsOfFile:@"mydata.plist"];
The second method works fine, but the first one freezes at startup.
The reason seems to be :
"You're assigning an autoreleased object to your cardsLoadedData ivar.
Next time the autorelease pool pops, your dictionary is going to get
released. Either retain the dictionary, or use alloc+init, or
(preferably) use self.cardsLoadedData= instead of just
cardsLoadedData=, which will assign via the property method, which
will retain for you (assuming you've set up the property correctly)."
For now I'm using the alloc / init / release route and it works fine.
And until I go through all the pages at http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html
I won't pretend to understand it all...
... but in the meantime, can I just ask in a nutshell when is it safe
to use the convenience methods (e.g. NSString, NSNumber, NSArray,
NSDictionary etc) and when to use the alloc/init ? Is it only safe
when used as a local variable in a function? or is it something to do
with the fact that there are different implementation blocks?
actually i never understood that either, why are there two
implementation blocks? (implementation myPlugin, and implementation
myPlugin (Execution) )
cheers,
Memo.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]