Is it possible to disable ATS in iOS 9 just for debug environment?

My solution is to keep ATS disable option at the default NO value and add a New Run Script Phase to change it in the app bundle’s Info.plist when building the app. This is the script: #Disables ATS in debug builds. INFOPLIST=”${TARGET_BUILD_DIR}”https://stackoverflow.com/”${INFOPLIST_PATH}” case “${CONFIGURATION}” in “Release”|”Adhoc”) /usr/libexec/PlistBuddy -c “Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO” “${INFOPLIST}” ;; “Debug”) /usr/libexec/PlistBuddy … Read more

Detect if app is running in Slide Over or Split View mode in iOS 9

Just check if your window occupies the whole screen: BOOL isRunningInFullScreen = CGRectEqualToRect([UIApplication sharedApplication].delegate.window.frame, [UIApplication sharedApplication].delegate.window.screen.bounds); If this is false, then you’re running in a split view or a slide over. Here is the code snipped which will automatically maintain this flag irrespective of rotation -(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { // simply create a property of ‘BOOL’ … Read more

This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes

Do not change UI from anything but the main thread. While it may appear to work on some OS or devices and not others, it is bound to make your application unstable, and crash unpredictably. If you must respond to a notification, which can happen in the background, then ensure UIKit invocation takes place on … Read more

Synchronous URL request on Swift 2

If you really wanna do it synchronously you can always use a semaphore: func send(url: String, f: (String) -> Void) { var request = NSURLRequest(URL: NSURL(string: url)!) var error: NSErrorPointer = nil var data: NSData var semaphore = dispatch_semaphore_create(0) try! NSURLSession.sharedSession().dataTaskWithRequest(request) { (responseData, _, _) -> Void in data = responseData! //treat optionals properly dispatch_semaphore_signal(semaphore) … Read more

Swipe-able Table View Cell in iOS 9

Try this, updated for Swift 3 (Developer Docs) override func tableView(_ tableView: UITableView, editActionsForRowAt: IndexPath) -> [UITableViewRowAction]? { let more = UITableViewRowAction(style: .normal, title: “More”) { action, index in print(“more button tapped”) } more.backgroundColor = .lightGray let favorite = UITableViewRowAction(style: .normal, title: “Favorite”) { action, index in print(“favorite button tapped”) } favorite.backgroundColor = .orange let … Read more

Is it possible to opt your iPad app out of multitasking on iOS 9

To opt-out (disable) multi-tasking for your application: Select your Target → General Section → Scroll Down and check Requires full screen It gets applied to the plist’s UIRequiresFullScreen key value. Note: Apps are required to support all screen orientations if it supports multitasking. Otherwise, apps will get the following error on publishing: Invalid Bundle. iPad … Read more