0

we are using a third 3 party library which comes with its own application delegate class.

In the main file of the of the application its initiating the

UIApplication object as follows :

retVal = UIApplicationMain(argc, argv, nil, @"3ThParty1AppDelegate");

Now, I don't have any source code of the app delegate class but I need to add methods for background processing and push notifications. Would it be possible at all to add it ?

thanks so much,

Guenter

jv42
  • 8,521
  • 5
  • 40
  • 64
xamiro
  • 1,391
  • 1
  • 16
  • 32

1 Answers1

0

The obvious way is to create a category that contains the additional methods. However that won't cut it if you need to add properties as well. In that case you need to extend the app delegate class. I've literally just this minute done the same things with the unit test driver for GH Unit to add additional methods to it's app delegate and it's used exactly the same way.

drekka
  • 20,957
  • 14
  • 79
  • 135
  • Thank you very much, unfortunately my objective - c is not very good but I will try my best. I guess I have to get the instance for "3ThParty1AppDelegate" and 'attach' the new methods later somehow. – xamiro Nov 04 '10 at 12:33
  • The concept is not hard. Grab an objective C developers guide and look up Categories. The basic idea is that a category allows you to add additional methods to any established class without having access to the source code. They differ from a extension to the class in that you do not create a new class. For example I can use a category to add a method to the NSObject class and the methods will be available to every class in the program because they all decend from NSObject. – drekka Nov 05 '10 at 12:23
  • Makes sense to me, I got over the half of the documentation. I didnt know its that easy with objective-c. Great thank you guys. Thats a quit thingy here. – xamiro Nov 05 '10 at 19:36