Its the first time i use unibill for my ios game and i got an issue when i try to build and run my app onto the device.
I get the message, that there is a use of undeclared idenifier for the case SKPaymentTransactionStateDeferred: (i didnt changed anything on the unibill plugin sourcecode) so iam not sure what to do.
i cant post an image so i post the code below. Pls watch on the line XCODE ISSUE.
// The transaction status of the SKPaymentQueue is sent here.
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray*)transactions {
NSLog(@"Unibill: updatedTransactions");
for(SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
// Item is still in the process of being purchased
break;
case SKPaymentTransactionStatePurchased:
case SKPaymentTransactionStateRestored: {
// Item was successfully purchased or restored.
NSMutableDictionary* dic;
dic = [[NSMutableDictionary alloc] init];
[dic setObject:transaction.payment.productIdentifier forKey:@"productId"];
[dic setObject:[self selectReceipt:transaction] forKey:@"receipt"];
NSData* data;
data = [NSJSONSerialization dataWithJSONObject:dic options:0 error:nil];
NSString* result;
result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseSuccess", result.UTF8String);
#if !__has_feature(objc_arc)
[result release];
[dic release];
#endif
// After customer has successfully received purchased content,
// remove the finished transaction from the payment queue.
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
break;
}
case SKPaymentTransactionStateDeferred:
**//XCODE ISSUE: USE OF UNDECLARED IDENTIFIER "SKPaymentTransactionStateDeferred"**
NSLog(@"Unibill: purchaseDeferred");
UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseDeferred", transaction.payment.productIdentifier.UTF8String);
break;
case SKPaymentTransactionStateFailed:
// Purchase was either cancelled by user or an error occurred.
NSString* errorCode = [NSString stringWithFormat:@"%d",transaction.error.code];
if (transaction.error.code != SKErrorPaymentCancelled) {
NSLog(@"Unibill: purchaseFailed: %@", errorCode);
UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseFailed", transaction.payment.productIdentifier.UTF8String);
} else {
NSLog(@"Unibill: purchaseFailed: %@", errorCode);
UnitySendMessage(UNITY_GAMEOBJECT_NAME, "onProductPurchaseCancelled", transaction.payment.productIdentifier.UTF8String);
}
// Finished transactions should be removed from the payment queue.
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
break;
}
}
}
does someone know what i should do? another question: where can i find the declaration of the cases called in the unibillstorekit.mm file? Or where do i have to declare this identifier?
please tell me if you need more specific informations.
note: iam just a beginner :)
Have you changed your deployment target?
The problem can be due to your deployment target pointing to iOS version below 8.0. SKPaymentTransactionStateDeferred
is only available in iOS version greater to 8. So if your deployment target is set to e.g. 7.1 you'll run into this error.
To get rid of this you can just update your deployment target to be greater or equal to 8.0 or use another (older) version of the library or plugin, repsectively
Hope this helps.