cocoa - NSString Retain Problems -


I'm having some problems with maintaining NSString. My problem is that this item on the second function (runItem) 1 does not matter, it does not matter what I set it, it seems that it's set to zero only. I am programming for coco (desktop versus iPhone), and I have this Type problem is not before NSString I'm not sure that I Because of what I am doing, so if someone can help me on this, I appreciate it! My code is in my AppController.h file:

  @interface AppController: NSObject {NSString * item1; } @protect (NSString * item1; - (IBAction) Run ITEM: (ID) sender; @end  

and AppController.m:

@ synthesis item 1; - (zero) Wake EphronNiB: {NSDictionary * savedFile = [Contentofffile with NSDictionary dictionary: @ "user / me / desktop / testing.plist"]; If (saved file! = Zero) {item 1 = [field item saved: @ "item title"]; AppController * Runfunction = [[[AppController alloc] init]; [Runfunction Run ITEM: Self]; } Else {item1 = zero; }} - (IBAction) Run item: (ID) sender NSLog (@ "% @", Item 1); }

Umm, although you have previously set item1 Created by AppController object (the application that is linked to the NIB file), you are creating an sec AppController object (directly , Through the default "init" constructor), whose item1 was never set up and then you can ask for the other object's item1 , then definitely This Zero is Maybe it's because you think that awakeFromNib is called whenever any object starts? But this is not entirely true awakeFromNib is called for only objects that are created when NIB files are loaded.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -