I need to pass the data from the UIViewController to AppDelegate. But should not with NSUserDefaults. I could not find an alternative for it even i don't want it.
if you need access to your delegate, I always create my singleton access in the next way :
// your imports...
#define appDelegate ((YourAppDelegate*)[UIApplication sharedApplication].delegate)
@class YourAppDelegate
//...
in the .h file of YourAppDelegate.
It´s helpful and useful, but do not abuse of the delegate to access to particular things, try to use a different way. Anyway, you can access in that way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.