Common issues in XCode 7 with iOS 9 SDK

Posted By : Nitin Bhatt | 07-Jun-2016

Apple Releases Xcode 7 With Swift 2 and SDKs for iOS 9, watchOS 2, OS X 10.11 El Capitan.

iOS 9 SDK

Xcode 7 introduced New Features to build better app

 

1) Free on device Testing 

   With the release of Xcode 7 , you get a new feature that Android developers have been enjoying since day one. Apple has changed its policy regarding permissions to build and run apps on device Until now Apple required user to pay $99/year to become a member of Apple Developer Program in order to run code on iPhone device. As part of the new Developer Program, this is no longer required.

User only required to pay $99/year when user want to send build to App Store.

 

2) Crash Logs 

For Crash logs there is no need to use third party libraries ,In the Xcode 7 Organizer window, click the Crashes tab to display a coalesced list of crash logs organized by teh apps you have submitted. When an app crashes , the system creates a crash log that describes the conditions under which the app terminated , in most cases including a complete stack trace for each executing thread. Apple provides a crash report service that collects and aggregates user crash logs.

 

To see crash logs click on Windows -> Organizer -> Select your app -> Select Crashes from the Top

 

 

Common Issues in Xcode7 with iOS9 SDK

 

1. App Transport Security Exception  in iOS9

 

   In iOS9 you cannot work with HTTP web data by default , because it's blocked by something called App Transport Security that effectively requires data to be transmitted securely. 

   

  What is App Transport Security :- 

   App Transport Security or ATS is a new feature of iOS9 and OS X EI Capitan. App Trasport Security aims to improve the security of Apple's operating systems. App Transport Security enforces secure connection between internet resources and you app. 

 
 Since ATS is enabled by default in apps built for iOS 9  all connections using NSUrlConnection ,CFUrl or NSUrlSession will be subject to ATS security requirements. If  your connections do not meet these requirement ,they will fail with an exception.            

 

   Follow the simple steps to resolve this problem

        (i) Open info.plist file

       (ii) Add a key NSAppTransportSecurity as a Dictionary

       (iii) Add a Subkey NSAllowsArbitraryLoads as Boolean and set its value to YES as lis image

 

          

        Alternative way to do this :- 

        Right click on info.plist file , click on source code then write this code inside info.plist file.

 <key>NSAppTransportSecurity</key>
     <dict>
     <key>NSAllowsArbitraryLoads</key>
     </true>
     </dict>

     

 2. App Store rejection because Facebook opens Safari browser to login in iOS9.

 

      Before iOS9, every iOS developer was having a common habbit of opening the mobile Safari browser whenever they want the user of their app to login with Facebook. In a way the user is directed to mobile Safari which is outside their app for Facebook login.

 

With the commence of iOS9, the Apple App Store starts rejecting any app which directs the user outside the app under consideration. iOS9 doesn't allow the user to go to the mobile Safari browser for Facebook login.

 

To solve this problem, SFSafariViewController class was introduced with iOS 9 which provides a full web view experience inside your app without having to spend important development time. SFSafariViewController opens a web view inside your app for Facebook login and hence user doesn't have to be directed towards mobile Safari browser for Facebook login.

 

To implement SFSafariViewController write this code inside your ViewController.swift file

import UIKit
import SafariServices

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let safariVC = SFSafariViewController(URL: NSURL(string: "http://apple.com")!)
        self.presentViewController(safariVC, animated: true, completion: nil)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}


 

 

About Author

Author Image
Nitin Bhatt

Nitin is an Assistant Project Manager specializing in iOS Application Development. He is an avid reader.

Request for Proposal

Name is required

Comment is required

Sending message..