我正在尝试使用此代码通过我的iPhone应用程序打开iBook:
- (void)goToiBookStore {
NSURL *url = [NSURL URLWithString:@"itms-books://itunes.apple.com/us/book/le-secret-du-poids/id711921224"];
//NSURL *url = [NSURL URLWithString:@"itms-bookss://itunes.apple.com/us/book/le-secret-du-poids/id711921224"]; // Also tried
//NSURL *url = [NSURL URLWithString:@"https://itunes.apple.com/us/book/le-secret-du-poids/id711921224?l=fr&ls=1"]; // Also tried
// On teste si iBook installed
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
else {
[[[UIAlertView alloc] initWithTitle:@"iBooks" message:NSLocalizedString(@"installer ibooks lab", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"annuler", nil) otherButtonTitles:NSLocalizedString(@"installer", nil), nil] show];
}
}
但是,URL不会将我发送到iBooks中的iBook,而是发送到下载页面,这是正常的吗?
答案 0 :(得分:1)
您可以打开iBooks,或打开该产品的商店,但不能直接打开图书。
如果你想打开iBooks:
NSString *stringURL = @"ibooks://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];