tags:

views:

74

answers:

3

(WebService_1AppDelegate*)[[UIApplication sharedApplication] delegate]

here - in above statement "WebService_1AppDelegate" is my application name.

But i don't understand what does this statement mean.

Please explain me - briefly this statement.

I will be thankful.

Thanks in advance for helping me.

+1  A: 

That statement only make sense if you have a class named WebService_1AppDelegate. Then it's casting the return value of that method (which is the application delegate) to that type. If that is indeed the name of your application delegate class then that cast is superfulous,

ennuikiller
It's surprising how many questions get answered in the documentation.
Terry Wilcox
+1  A: 

Are you trying to figure out what "AppDelegate" is in an iPhone app? If so, AppDelegate acts as a central storage medium for your application that allows you to share data across all of your controllers seamlessly. If you're familiar with web development it is just like a Session variable.

Nathan Taylor
Ok ! That's a great answer. I got the Idea. Your answer helped me a lot.
sugar
Glad I could help.
Nathan Taylor
+2  A: 

An AppDelegate is a singleton that every iPhone program has. This class is responsible for receiving many system calls such as applicationDidFinishLaunching, applicationWillTerminate etc. It is the entry point for an iPhone app.

Each app defines their own AppDelegate and thus WebService_1AppDelegate is yours. You can define your own methods/properties there and when required cast the AppDelegate returned from [UIApplication sharedApplication] to access your methods/properties.

WebService_1AppDelegat *appDelegate = (WebService_1AppDelegate*)[[UIApplication sharedApplication] delegate];
[appDelegate yourCustomMethod];
Jab