2015-05-26 86 views
0

我只是試圖在我的應用程序中實現iTunes商店屏幕,並且它顯示正確。然而,當用戶完成了屏幕(進行購買或點擊「取消」),我所得到的只是一個白色屏幕,我必須完全關閉我的應用程序並重新打開它。我的productViewControllerDidFinish方法不被調用。SKStoreProductViewControllerDelegate方法不被調用

我有一個表視圖控制器,它具有SKStoreProductViewControllerDelegate,我在同一個類中呈現和解散商店視圖,爲什麼不調用委託方法?

- (void)toStore:(Button*)sender { 
    SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init]; 
    [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : @"stuff"} completionBlock:^(BOOL result, NSError *error) { 
     if (error) { 
      NSLog(@"Error %@ with User Info %@.", error, [error userInfo]); 

     } else { 
      [self presentViewController:storeProductViewController animated:YES completion:nil]; 
     } 
    }]; 
} 

- (void)productViewControllerDidFinish:(SKStoreProductViewController*)viewController { 
    [self dismissViewControllerAnimated:YES completion:nil]; 
} 

兩者都在UITableViewController中。提前致謝!

回答

0

SKStoreProductViewController控制器的設置委託..你錯過了做..

設置它只是對象分配如下..

storeProductViewController.delegate = self; 
+0

簡單的錯誤,謝謝! – evanlws