【发布时间】:2013-04-09 17:07:32
【问题描述】:
我将新 API 用于应用内应用商店产品视图。我知道它应该只适用于 IOS 6 及更高版本,但是,我的应用程序是针对 ios 5 及更高版本的。现在,当您点击将您带到商店的按钮时,该应用程序将变得柠檬并冻结您!
SKStoreProductViewController
如何测试此设备是否能够执行此功能?或者如果这是 ios 6 及更高版本?
我正在寻找类似于“应用内邮件”的东西,它有一个名为CanSendMail 的方法,SKStore 有这样的方法吗?
另外
我将框架弱链接为Option。
UPADTE
我试过用这个但是还是不行!!没有任何日志:(
if (error) {
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device doesn't support In-App Product View"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
} else {
// Present Store Product View Controller
[self presentViewController:storeProductViewController animated:YES completion:nil];
}
}];
}
【问题讨论】:
-
您可以查看SDK Compatibility Guide,了解有关正确执行运行时检查的完整详细信息,例如此类。
-
@rmaddy 所以我知道这个类没有特殊的方法,比如
CanSendMailinMailComposer? -
不,没有。我从来没有暗示有。即使有,它在 iOS 5.x 下也无用,因为直到 6.0 才添加该类。我提供的链接将帮助您正确使用您的应用支持的每个 iOS 版本中不存在的类、方法和框架。请参阅 Adam 的答案以正确检查
SKStoreProductViewController类。
标签: ios objective-c cocoa-touch methods