iOS上的城市飞艇实施

时间:2013-02-28 09:30:26

标签: ios objective-c urbanairship.com

我试图通过转向Build Phases>添加libUAirship-1.4.0.a; Link Binary With Libraries并在磁盘上定位库,在这样做后,我仍然收到一个错误,说使用未声明的标识符: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;
}

2 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:1)

我已经看到了如何设置标头搜索路径的许多不同变体。 对我来说,这很有效。飞艇文件夹与项目处于同一级别。

$(PROJECT_DIR)/Airship