IOS Notes
Posted on 17 Mayıs 2018 in Programlama by admin
To call a function when application becomes active
NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActive), name: NSNotification.Name.UIApplicationDidBecomeActive, object: nil)
@objc func didBecomeActive() {
print(“did become active”)
//Do signaling offline works
}
—————
https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StrategiesforHandlingAppStateTransitions/StrategiesforHandlingAppStateTransitions.html
Creation of temporary url path:
let destURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(“manifest.plist”)
Printing content of url
let contents = try String(contentsOf: destURL)
print(“!! contents:\(contents)”)