问题描述
此代码来自Phonegap代码:IAP插件。错误发生在发送js之后的代码行。发送到函数的所有元素都是非零,除了最后一个nil。我甚至登出他们,以确保他们发送。此代码即将使用此插件( https://github.com/usmart/InAppPurchaseManager-EXAMPLE)并且除了日志记录之外没有被修改。在调试器中我看到没有对象是nil,所以我不明白为什么错误正在发生。
This code is from the Phonegap Code: IAP Plugin. The error happens on the line of the code right after the "sent js". All the elements sent to the function are non-nil except for the last one 'nil'. I even logged them out to make sure they were sent. This code is right out of the plugin (https://github.com/usmart/InAppPurchaseManager-EXAMPLE) and has not been modified except for the logging. In the debugger i saw that none of the objects were nil, so i don't understand why the error is happening.
这里是错误:
这里是代码:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse: (SKProductsResponse *)response
{
NSLog(@"got iap product response");
for (SKProduct *product in response.products) {
NSLog(@"sending js for %@", product.productIdentifier);
NSLog(@" title %@", product.localizedTitle );
NSLog(@" desc%@ - %@", product.localizedDescription, product.localizedPrice );
NSArray *callbackArgs = [NSArray arrayWithObjects:
NILABLE(product.productIdentifier),
NILABLE(product.localizedTitle),
NILABLE(product.localizedDescription),
NILABLE(product.localizedPrice),
nil ];
NSLog(@"sent js");
NSString *js = [NSString stringWithFormat:@"%@.apply(plugins.inAppPurchaseManager, %@)", successCallback, [callbackArgs JSONSerialize]];
NSLog(@"js: %@", js);
[command writeJavascript: js];
}
推荐答案
JSONRepresentation
是 SBJson
添加的类别,因此您必须将 SBJson.h
使用它的类。
JSONRepresentation
is a category that SBJson
adds so you have to include SBJson.h
in the class that uses it.
这篇关于获取IAP产品响应后的Objective-C错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!