Search code examples
xtify

Failed to incorporate iOS SDK


XCODE 6.0.1
IBM Push Notification SDK for Apple iOS 2.7.3

I created new project(So my app is just hello world app), and I followed the steps below.

I added following property to info.plist.

  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysUsageDescription

I added "-fno-objc-arc" compiler flag to below files since the ARC is valid in myproject.

  • CompanyInboxViewCell.m
  • CompanyCustomInbox.m
  • CompanyInboxVC.m
  • CompanyDetailsVC.m
  • AppDelegate.m

I built it. Then I got following errors in "registerForPush method", which is in "XLXtifyOptions.m" file.
capture is here

/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];

Any ideas?
Thanks in advance!


Solution

  • It seems that "#import '<'UIKit/UIKit.h'>'" is correct solution.
    IBM Push Notification SDK for Apple iOS 2.7.3 was updated to 2.7.4. "XLXtifyOptions.m" of 2.7.4 version import UIKit/UIKit.h.

    After that, I succeeded to build. But I got following error when I executed it.

    [XLappMgr init]
    2014-11-12 13:40:38.811 XtifyApp[479:95045] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSPlaceholderString initWithString:]: nil argument' *** First throw call stack: (0x181d9e084 0x1923d40e4 0x181d9dfc4 0x182b9d8b4 0x10004ef0c 0x10004e738 0x10003f784 0x1865864a4 0x100042608 0x192a42a08) libc++abi.dylib: terminating with uncaught exception of type NSException

    I added "Bundle display name" property to info.plist. Then above error is gone.

    Thanks.