I have created a universal framework in which i want to swizzle the App delegate's method so that i can get the device token directly in my framework Here is the code

+ (void)load {  
    Method original =    class_getInstanceMethod(self, @selector(applicationDidFinishLaunching:));  
    Method custom =    class_getInstanceMethod(self, @selector(customApplicationDidFinishLaunching:));  
    method_exchangeImplementations(original, custom);  
- (void)customApplicationDidFinishLaunching:(UIApplication *)application {  
    NSLog(@"extra thing");  

    // this looks like recursion, but because the insides of the methods are swapped, we are actually calling the original implementation of the method  
    [self customApplicationDidFinishLaunching:application];  

It's not getting called since frameworks do not have app delegate and i am not getting the instance of the app frame work is copied

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.