0

Since I updated my amazon web services app I created with AWS Mobilehub to swift 3 I receive the following error message:

enter image description here

As soon as I use "!" to remove the error my app crashes due to a fatal error:

enter image description here

  • Im pretty sure you need return something like AWSMobileClient.sharedInstance.didFinishLaunching(application: application, withOptions: launchOptions as [NSObject : AnyObject]?) – Devster101 Sep 26 '16 at 19:22

3 Answers3

2

The AWS Mobile Hub console does not yet provide Swift 3 sample app code. The Swift sample app download can only be used with the legacy compiler setting in the Xcode project. We have received multiple requests for Swift 3 support, so we are working to prioritize it, but I can't provide an expected completion date at this time.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Andrew C
  • 406
  • 2
  • 6
0

launchOptions is an optional. If no shortcut is passed in, it will be nil. Check the value before passing to AWSMobileClient like so...

if let launchOptions != nil {
  return AWSMobileClient.sharedInstance.didFinishLaunching(application, withOptions: launchOptions!)
}

return false
Justin Domnitz
  • 3,217
  • 27
  • 34
0

Modify 'func didFinishLaunching' method in AWSMobileClient.swift,

if (!isInitialized) {
    AWSIdentityManager.defaultIdentityManager().resumeSession(completionHandler: { (result, error) in
        print("Result: \(result) \n Error:\(error)")
    })
    isInitialized = true
}