iphone - Problem with my app delegate -


I am trying to create an app that contains a class created in an app representative. I get started with:

  mobile * tmp = [[mobile allocation] init]; Mobile = tmp; [TMP release];   

And after that I try to use it in other sections of my app: Delegate * (projectAppDelegate *) [ UIApplication share application] representative]; Mobile = delegate.mobile;

But when I do this:

  [enter mobile: x: y];   

it crashes ...

Is there anything that I have done wrong, or there is a solution to create a class that Can use all other classes?

Thanks

If you want to use the examples of your object, To store as representative properties.

  // appdelegate.h // // ... Interface app deliitte: NSObact & lt; UIApplicationDelegate & gt; {Mobile * TMP; } // ... //appdelegate.m // // ... // - (BOOL) Application: (UIApplication *) Application FinishLaunchingWithOptions: (NSDictionary *) Launchoptions {mobile = [[Mobile Allocation] init]; } // ... - (zero) Delok [[Mobile release]; [Super DeLoc]; // ...}   

You need to get a pointer to your app dealer and call your mobile property.

  // ... anywhere AppDelegate * ref = (AppDelegate *) [[UIApplication shared application] representative]; NSLog (@ "% @", [reference mobile]); // ...    

Comments