Trying to get IOS SDK working in Swift 3 / xCode 8 - getting "[UAirship takeOff] was not called" error

I'm about at my wits end here. I felt certain that I had everything set up correctly, but I am just not having any luck.

I took the following steps:

1. I downloaded "libUAirship-8.0.4.zip", and unpackaged it
2. I created a new Single View Application
3. I copied the folders Airship, AirshipKit, and AirshipAppExtensions into my project folder
4. I dragged the Airship & AirshipKit folders into the top level of my project, and chose "Copy items if needed", "Create folder references", and made sure the main app target was checked.
5. I opened the local directory containing my project, navigated to the AirshipKit folder, and dragged the "AirshipKit.xcodeproj" file into the top level of my project.
6. I added the project to the "Embedded Libraries", and ensured that it also showed up in the "Linked Frameworks and Libraries" list as well.
7. I checked to make sure both "Enable Modules" and "Link Frameworks Automatically" were both set to yes in the Build Settings tab.
8. I downloaded my AirshipConfig.plist file from the Urban Airship project quick guide, and dragged it into the top level of my project, choosing the options "Copy items if needed", "Create folder references", and made sure the main app target was checked.
9. I went into my AppDelegate.swift file and typed "import AirshipKit". This produces an error at first, but when I build the project the build succeeds.
10. I added the following function into my AppDelegate.swift file, based off of the contents of the sample Swift file (with modifications):

var window: UIWindow?
private
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        let config = UAConfig.default()
        config.messageCenterStyleConfig = "UAMessageCenterDefaultStyle"
        UAirship.takeOff(config)
        return true
}

11. I created a new target (File > New > Target) and selected Notification Service Extension, which I named "ExampleServiceExtension", and checked to make sure that my app had the new target listed under the Embed App Extensions under Build Phases.
12. I dragged the AirshipAppExtensions framework into the top level of my project.
13. In the new target that I created, I added the AirshipAppExtensions framework to the Target Dependencies, Link Binary With Libraries, under the Build Phases tab.
14. I added a new Copy Files row, selected the "Frameworks" dropdown, and added the AirshipAppExtensions framework to it.
15. I navigated to the "NotificationService.swift" file in my project browser, cleared the code out of it, and added the following code into it:

import AirshipAppExtensions
class NotificationService: UAMediaAttachmentExtension {
}

16. I created a new certificate & such and made sure that the bundle identifier is the same in both the app and the certificate.
17. I imported "AirshipKit" into my main ViewController file.
18. I ran the app, and the build succeeded, but the console gives me this message:
"
2016-11-12 22:18:20.711803 pushNotifications-v3[7589:1906166] [E] __52+[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 302] [UAirship takeOff] was not called in application:didFinishLaunchingWithOptions:

2016-11-12 22:18:20.711886 pushNotifications-v3[7589:1906166] [E] __52+[UAirship handleAppDidFinishLaunchingNotification:]_block_invoke [Line 303] Please ensure that [UAirship takeOff] is called synchronously before application:didFinishLaunchingWithOptions: returns"

Using the test message in the Urban Airship quick guide, I tried sending a message, to no avail.

 

At this point I really have no idea what else I need to do in order to make this work. Can ANYBODY please shed some light here? Any help would be appreciated.

 

Thank you!

Didn't find what you were looking for?

New post

Comments

1 comment

  • Hi John,

    I'd be happy to help!

    First off, I would highly recommend integrating the Swift Sample, included with the UA iOS library, if you need to build a working app on your device.

    As to the problem you're running into, I'm not entirely certain how you have the rest of your App Delegate laid out, but if you could, go ahead and remove the "private" keyword from the didFinishLaunchingWithOptions.

    Your didFinishLaunchingWithOptions should look more like the following:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool

    Go ahead and make that change and let me know what happens after that!

    Comment actions Permalink
    0

Please sign in to leave a comment.