我正在使用新的API进行应用内商店产品视图。我知道它应该只适用于IOS 6及更高版本,但是,我的应用程序针对iOS 5及更高版本。现在,当您按下需要存储的按钮时,应用程序将变为柠檬并冻结在您身上!应用商店产品视图,不适用于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兼容性指南](https://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/cross_development/Introduction/Introduction.html#//apple_ref/doc/) uid/10000163i)以获取正确执行此类运行时检查的完整详细信息。 – rmaddy
@rmaddy所以我明白这个类没有特殊的方法,例如'MailComposer'中的'CanSendMail'? – user1949873
不,没有。我从来没有暗示过。即使有,在iOS 5.x下也没有用处,因为直到6.0版才加入类。我提供的链接将帮助您正确使用应用程序支持的每个iOS版本都不存在的类,方法和框架。请参阅Adam的回答以正确检查“SKStoreProductViewController”类。 – rmaddy