iOS上的城市飞艇实现 [英] Urban Airship Implementation on iOS

查看:81
本文介绍了iOS上的城市飞艇实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下步骤添加libUAirship-1.4.0.a:转到构建阶段>使用库链接二进制文件并在磁盘上找到该库,这样做之后,我仍然收到错误消息,指出使用未声明的标识符:UAirshipTakeOffOptionsLaunchOptionsKey,UAirship ,UAPush.

I am trying to add libUAirship-1.4.0.a by going to Build Phases > Link Binary With Libraries and locating the library on disk, after doing so i am still getting an error saying use of undeclared identifier: UAirshipTakeOffOptionsLaunchOptionsKey, UAirship, UAPush.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    //Create Airship options dictionary and add the required UIApplication launchOptions
    NSMutableDictionary *takeOffOptions = [NSMutableDictionary dictionary];
    [takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];

    // Call takeOff (which creates the UAirship singleton), passing in the launch options so the
    // library can properly record when the app is launched from a push notification. This call is
    // required.
    //
    // Populate AirshipConfig.plist with your app's info from https://go.urbanairship.com
    [UAirship takeOff:takeOffOptions];

    // Set the icon badge to zero on startup (optional)
    [[UAPush shared] resetBadge];

    // Register for remote notfications with the UA Library. This call is required.
    [[UAPush shared] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                                         UIRemoteNotificationTypeSound |
                                                         UIRemoteNotificationTypeAlert)];

    // Handle any incoming incoming push notifications.
    // This will invoke `handleBackgroundNotification` on your UAPushNotificationDelegate.
    [[UAPush shared] handleNotification:[launchOptions valueForKey:UIApplicationLaunchOptionsRemoteNotificationKey]
                       applicationState:application.applicationState];

    return YES;
}

推荐答案

您需要#import与库关联的头文件,以便符号可用.对于这个库,我相信您想在源文件的顶部添加以下内容:

You need to #import the header file associated with the library in order for the symbols to be available. For this library I believe you want to add the following to the top of your source file:

#import "UAirship.h"
#import "UAPush.h"

这篇关于iOS上的城市飞艇实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆