Skip object from VC to App Delegate

I have several objects in VC that I want to receive from my application delegate.

My VC launches another application that makes a callback in my application. This callback launches a method in my application deletion:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 

But I want to access some of the objects in this method that I installed in the previous VC. Any ideas how?

0
source share
1 answer

Use

 +(id)sharedApplicationDelegate; in delegate.h, and write +(id)sharedApplicationDelegate{ return [[UIApplication sharedApplication] delegate]; } 

In the delegate. Make the object data type variable in .h and set its property. Write a method similar to this:

 -(void)setObjectForDelegate:(ObjectType *)value{ //use value obj or set it to other variable } 

How to use:

 #import "XXXXdelegate.h" [[UIApplication sharedApplication] setObjectForDelegate:object]; 
+1
source

Source: https://habr.com/ru/post/1384671/


All Articles