1

XCODE 6.0.1
IBM プッシュ通知 SDK for Apple iOS 2.7.3

私は新しいプロジェクトを作成し(私のアプリは単なるHello Worldアプリです)、以下の手順に従いました。

info.plist に以下のプロパティを追加しました。

  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysUsageDescription

myproject では ARC が有効であるため、"-fno-objc-arc" コンパイラ フラグを以下のファイルに追加しました。

  • CompanyInboxViewCell.m
  • CompanyCustomInbox.m
  • CompanyInboxVC.m
  • 会社詳細VC.m
  • AppDelegate.m

私はそれを構築しました。次に、「XLXtifyOptions.m」ファイルにある「registerForPush メソッド」で次のエラーが発生しました。
キャプチャはこちら

/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:107:5: error: use of undeclared identifier 'UIApplication'
UIApplication * app = [UIApplication sharedApplication];
^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:107:21: error: use of undeclared identifier 'app'
UIApplication * app = [UIApplication sharedApplication];
                ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:107:28: error: use of undeclared identifier 'UIApplication'
UIApplication * app = [UIApplication sharedApplication];
                       ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:110:9: error: use of undeclared identifier 'app'
if([app respondsToSelector:@selector(registerForRemoteNotifications)])
    ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:112:9: error: use of undeclared identifier 'UIUserNotificationType'
    UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
        ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:113:9: error: use of undeclared identifier 'UIUserNotificationSettings'
    UIUserNotificationSettings * settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
    ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:113:38: error: use of undeclared identifier 'settings'
    UIUserNotificationSettings * settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
                                 ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:113:50: error: use of undeclared identifier 'UIUserNotificationSettings'
    UIUserNotificationSettings * settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
                                             ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:114:10: error: use of undeclared identifier 'app'
    [app registerUserNotificationSettings: settings];
     ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:115:10: error: use of undeclared identifier 'app'
    [app registerForRemoteNotifications];
     ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:120:9: error: use of undeclared identifier 'UIRemoteNotificationType'
    UIRemoteNotificationType types = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert;
    ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:122:13: error: use of undeclared identifier 'types'
        types = UIRemoteNotificationTypeNewsstandContentAvailability | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert;
        ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:122:21: error: use of undeclared identifier 'UIRemoteNotificationTypeNewsstandContentAvailability'
        types = UIRemoteNotificationTypeNewsstandContentAvailability | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert;
                ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:122:76: error: use of undeclared identifier 'UIRemoteNotificationTypeBadge'
        types = UIRemoteNotificationTypeNewsstandContentAvailability | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert;
                                                                       ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:122:108: error: use of undeclared identifier 'UIRemoteNotificationTypeSound'
        types = UIRemoteNotificationTypeNewsstandContentAvailability | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert;
                                                                                                       ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:122:139: error: use of undeclared identifier 'UIRemoteNotificationTypeAlert'
        types = UIRemoteNotificationTypeNewsstandContentAvailability | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert;
                                                                                                                                      ^
/Users/username/Documents/objectiveCpractice/appname/XtifyLib/XLXtifyOptions.m:123:10: error: use of undeclared identifier 'app'
    [app registerForRemoteNotificationTypes:types];

何か案は?
前もって感謝します!

4

1 に答える 1

1

「#import '<'UIKit/UIKit.h'>'」が正解のようです。
IBM Push Notification SDK for Apple iOS 2.7.3 が 2.7.4 に更新されました。2.7.4版の「XLXtifyOptions.m」はUIKit/UIKit.hをインポート。

その後、ビルドに成功しました。しかし、実行すると次のエラーが発生しました。

[XLappMgr init]
2014-11-12 13:40:38.811 XtifyApp[479:95045] * キャッチされていない例外 'NSInvalidArgumentException' が原因でアプリを終了しています。理由: '* -[NSPlaceholderString initWithString:]: nil argument' *** 最初のスローコールスタック: (0x181d9e084 0x1923d40e4 0x181d9dfc4 0x182b9d8b4 0x10004ef0c 0x10004e738 0x10003f784 0x1865864a4 0x100042608 0x100042608 0x192unca42a08)

info.plistに「バンドル表示名」プロパティを追加しました。その後、上記のエラーはなくなりました。

ありがとう。

于 2014-11-12T04:53:11.913 に答える