SDK 4.3中的restoreCompletedTransactions是否已损坏?
我正在尝试恢复我的自动续订订阅.它不会导致对updatedTransactions的回调.这是我的代码.
{
....
[appDelegate.inapp loadStore];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
....
}
Run Code Online (Sandbox Code Playgroud)
期待回调到updatedTransactions,但不接收它.
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
NSLog(@"IN updatedTransactions, transaction.transactionState");
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
...
...
case SKPaymentTransactionStateRestored:
NSLog(@"IN updatedTransactions, SKPaymentTransactionStateRestored");
[self restoreTransaction:transaction];
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我最后接到了这个电话.
-(void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
}
Run Code Online (Sandbox Code Playgroud) 我正在使用MPMoviePlayerViewController文档中提到的类似代码.但它不起作用.它说"你没有被授权......".我的服务器托管在雅虎上.网址是这样的.
代码如下
NSURLCredential *credential = [[NSURLCredential alloc]
initWithUser:@"abc"
password:@"xyz"
persistence: NSURLCredentialPersistencePermanent];
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost:@"www.someurl.com"
port:80
protocol:@"http"
realm:@"tmp"
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential
forProtectionSpace:protectionSpace];
[protectionSpace release];
[credential release];
MPMoviePlayerViewController *movie = [[[MPMoviePlayerViewController alloc] initWithContentURL:url] autorelease];
Run Code Online (Sandbox Code Playgroud)