本文介绍了iPhone PayPal初始化失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在我的应用中初始化PayPal.有时,我会收到网络超时"错误,并且如果我尝试初始化PayPal,则此警报会一次又一次地出现.如何避免这种情况?如何正确初始化贝宝?我的代码是:
I try to init PayPal in my app. Sometimes I get "Network Timeout" error and if I retry to init PayPal this alerts appear again and again. How to avoid this? How to reinit PayPal correctly? My code is:
- (void)initializePayPal {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[PayPal initializeWithAppID:PP_APP_ID forEnvironment:ENV_SANDBOX];
while ([PayPal initializationStatus] == STATUS_INPROGRESS) {
[NSThread sleepForTimeInterval:1];
}
switch ([PayPal initializationStatus] ) {
case STATUS_COMPLETED_SUCCESS:
NSLog(@"STATUS_COMPLETED_SUCCESS");
break;
case STATUS_COMPLETED_ERROR: {
NSDictionary *responseMessage = [PayPal getInstance].responseMessage;
NSLog(@"STATUS_COMPLETED_ERROR:%@", responseMessage);
if ([[responseMessage objectForKey:@"errorId"] integerValue] == 10818) {
[self initializePayPal];
}
}
break;
default:
break;
}
[pool release];
}
推荐答案
当我使用ENV_SANDBOX时,PayPal初始化有时会失败当我开始使用ENV_LIVE而不是ENV_SANDBOX时,问题已解决.
PayPal init failed sometimes when i use ENV_SANDBOX The problem was solved when i start use ENV_LIVE instead ENV_SANDBOX
这篇关于iPhone PayPal初始化失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!