1

我正在尝试使用以下代码通过我的 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,而是发送到下载页面,这正常吗?

http://img4.hostingpics.net/thumbs/mini_953506photo.png

4

1 回答 1

1

您可以打开 iBooks,或打开该产品的商店,但不能直接打开一本书。

如果要打开 iBooks:

NSString *stringURL = @"ibooks://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

2019 年更新:您现在可以通过包含要打开的图书的资产 ID 打开 iBooks 到特定图书。例子:

ibooks://assetid/1396541327

Apple.com 网站上提供了详细信息 - https://support.apple.com/en-us/HT202929

于 2013-09-24T11:34:07.430 回答