iOS上的城市飞艇实现(Urban Airship Implementation on iOS)

2019-08-17 05:39发布

我试图去构建阶段添加libUAirship-1.4.0.a>链接二进制与图书馆和定位磁盘上的图书馆,这样做后,我仍然得到一个错误说使用未声明的标识符的: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;
}

Answer 1:

您需要#IMPORT与库,以便使符号可用相关的头文件。 对于这个图书馆,我相信你想添加以下到您的源文件的顶部:

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


Answer 2:

我已经看到了如何设置标题搜索路径许多不同的变化。 对我来说,这个工作。 飞艇文件夹是在同一级别的项目。

$(PROJECT_DIR)/Airship


文章来源: Urban Airship Implementation on iOS