I have a situation in which i have to intialize an object everytime when it comes from background to foreground and that should be using the NSNotificationCenter not with appdelegate because iam building a static library so there wont be appdelegate with that so please help me in the same.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
Swift 3 version
you can also use
NSNotification.Name.UIApplicationDidBecomeActive
Have you tried
UIApplicationWillEnterForegroundNotification
?The app also posts a UIApplicationWillEnterForegroundNotification notification shortly before calling
applicationWillEnterForeground:
to give interested objects a chance to respond to the transition.Subscribe to notification:
Implement a code, that need to be called:
Don't forget to unsubscribe:
swift 4.1
Swift 3 and 4 version
Swift 4.2