Cocos2dx的Nextpeer问题

时间:2015-09-05 11:43:53

标签: ios xcode cocos2d-x nextpeer

我在iOS中使用带有cocos2dx的Nextpeer。   我已成功配置了带有cocos2dx的Nextpeer sdk。   在“AppController.mm”中我使用以下代码

    [Nextpeer initializeWithProductKey:@"KEY" andDelegates:[NPDelegatesContainer containerWithNextpeerDelegate:self]];

但我的代码崩溃了以下日志

    2015-09-05 17:05:06.621 Test-mobile[5474:79097] Using Nextpeer version 2.2.2, build number 28, server: https://api.nextpeer.com/v3
2015-09-05 17:05:08.250 Test-mobile[5474:79097] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010ac52c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010a828bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010ac52b9d +[NSException raise:format:] + 205
    3   Foundation                          0x0000000109af37ef +[NSJSONSerialization JSONObjectWithData:options:error:] + 67
    4   Test-mobile                         0x00000001060a85e5 -[NPStringsService loadResourceBundleStrings] + 159
    5   Test-mobile                         0x00000001060a82f1 -[NPStringsService fillStringModel] + 41
    6   Test-mobile                         0x00000001060a7ec1 -[NPStringsService init] + 72
    7   Test-mobile                         0x00000001060a7e2b +[NPStringsService initializeService] + 58
    8   Test-mobile                         0x0000000106061b2f +[Nextpeer initializeWithProductKey:andSettings:andDelegates:] + 1150
    9   Test-mobile                         0x00000001060616a4 +[Nextpeer initializeWithProductKey:andDelegates:] + 50
    10  Test-mobile                         0x000000010605ef07 -[AppController application:didFinishLaunchingWithOptions:] + 1095
    11  UIKit                               0x00000001077da788 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 240
    12  UIKit                               0x00000001077db397 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2540
    13  UIKit                               0x00000001077de1de -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
    14  UIKit                               0x00000001077dd0d5 -[UIApplication workspaceDidEndTransaction:] + 179
    15  FrontBoardServices                  0x000000010e4a05e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
    16  CoreFoundation                      0x000000010ab8641c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    17  CoreFoundation                      0x000000010ab7c165 __CFRunLoopDoBlocks + 341
    18  CoreFoundation                      0x000000010ab7bf25 __CFRunLoopRun + 2389
    19  CoreFoundation                      0x000000010ab7b366 CFRunLoopRunSpecific + 470
    20  UIKit                               0x00000001077dcb42 -[UIApplication _run] + 413
    21  UIKit                               0x00000001077df900 UIApplicationMain + 1282
    22  Test-mobile                         0x000000010605f604 main + 100
    23  libdyld.dylib                       0x000000010b83b145 start + 1
    24  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException.

Nextpeer SDK版本是2.2.2。 Cocos2dx SDK版本是3.7.1。 Xcode版本是6.3.2。

我如何解决这个问题。

我试过以下代码

@try {
    if([Nextpeer isNextpeerSupported])
    {
        NSLog(@"AAAAAAAAA");
        [Nextpeer initializeWithProductKey:@"88b83720cf1fa8e9f2007f29e91b9dd6" andDelegates:[NPDelegatesContainer containerWithNextpeerDelegate:self]];
    }
    else
        NSLog(@"BBBBBBBB");
}
@catch (NSException * e) {
    NSLog(@"Exception: %@", e);
}
@finally {

}

但获得异常

2015-09-07 11:33:44.382 Test-mobile[2811:25650] Name: NSInvalidArgumentException
2015-09-07 11:33:44.382 Test-mobile[2811:25650] Reason: data parameter is nil

0 个答案:

没有答案
相关问题