Determine user’s “Temperature Unit” setting on iOS 10 (Celsius / Fahrenheit)

There is an (NS)MeasurementFormatter class. It inherits from an (NS)Formatter class. It’s a new class available for iOS 10+ SDK. I am not sure whether it’s necessary to know, what unit a user has set in their preferences. To set a Measurement using Swift 3: let formatter = MeasurementFormatter() let measurement = Measurement(value: 24.5, unit: … Read more

NSPhotoLibraryUsageDescription in Xcode8

Localizing of info.plist file may be very unuseful, especially if you use many languages in your apps. The simplest way for localizing NSPhotoLibraryUsageDescription, NSLocationWhenInUseUsageDescriptionor NSCameraUsageDescription keys is to describe it in InfoPlist.strings file. Create new *.strings file with name InfoPlist; Press Localize… button in file inspector and choose the default language; Add new records in … Read more

iOS11 swift silent push (background fetch, didReceiveRemoteNotification) is not working anymore

Final UPDATE 2017-10-31 Apple just had its official (Halloween) release of iOS 11.1 UPDATE 2017-10-09 Apple released iOS11.1 beta 2 today. Again they mentioned in their Release Notes the following note: Notifications Resolved Issues Silent push notifications are processed more frequently. (33278611) I’m going to test again this beta 2 version and update this answer … Read more

The “prefs” URL Scheme is not working in iOS 10 (Beta 1 & 2)

Just replace prefs to App-Prefs for iOS 10 Below code works for iOS 8,9,10 Swift 3.0 and Xcode >= 8.1 if #available(iOS 10.0, *) { UIApplication.shared.openURL(URL(string: “App-Prefs:root=SOMETHING”)!) } else { UIApplication.shared.openURL(URL(string: “prefs:root=SOMETHING”)!) } Swift 2.2 if #available(iOS 10.0, *) { UIApplication.sharedApplication().openURL(NSURL(string:”App-Prefs:root=SOMETHING”)!) } else { UIApplication.sharedApplication().openURL(NSURL(string:”prefs:root=SOMETHING”)!) } Works for me. Happy Coding 😊

iOS 10 bug: UICollectionView received layout attributes for a cell with an index path that does not exist

This happened to me when number of cells in collectionView changed. Turns out I was missing invalidateLayout after calling reloadData. After adding it, I haven’t experienced any more crashes. Apple has made some modifications to collectionViews in iOS10. I guess that’s the reason why we are not experiencing same problem on older versions. Here’s my … Read more