简体   繁体   English

iTunes音乐曲目查看URL打开错误

[英]iTunes Music track view url open error

I am getting iTunes Track view url from this api http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=hello&entity=musicTrack&&limit=10 我从此api获取iTunes Track视图的URL http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=hello&entity=musicTrack&&limit=10

"trackViewUrl":"https://itunes.apple.com/us/album/hello/id405926181?i=405926184&uo=4"

When I am trying to load track view url using below code I am getting Safari Can't open page. 当我尝试使用以下代码加载跟踪视图网址时,我无法打开Safari页面。 I logged string of url it's absolutely fine and it's opening in browser of my mac also. 我记录了url字符串,这绝对好,它也在我的mac电脑的浏览器中打开。

NSString *trackViewUrl =[music objectForKey:@"trackViewURL"];
    NSLog(@"iTunes URL : %@",trackViewUrl);
    NSURL *appstoreURL = [NSURL URLWithString:trackViewUrl];
    [[UIApplication sharedApplication] openURL:appstoreURL];

Any idea? 任何想法?

Your NSLog() statement should be outputting iTunes URL : (null) . 您的NSLog()语句应输出iTunes URL : (null)

NSLog(@"iTunes URL : %@",trackViewUrl);

You're attempting to access the dictionary's object for the trackViewURL key, but it looks like it should be trackViewUrl , with the "r" and the "l" lowercase. 您正在尝试为trackViewURL键访问字典的对象,但看起来它应该是trackViewUrl ,其小写字母为“ r”和“ l”。 Try again after correcting the case of these characters. 更正这些字符的大小写后,请再试一次。

EDIT: That possible typo aside, I've just tested your code with corrected capitalization, and it works fine. 编辑:除了可能的错字,我刚刚用正确的大写字母测试了您的代码,并且工作正常。 It is important to note however that this will not work on the simulator. 重要的是要注意,但这在模拟器上不起作用。 You need to use it on a real device that actually has the iTunes app installed. 您需要在实际安装了iTunes应用程序的真实设备上使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 打开应用程序时iTunes Music停止 - iTunes Music stops when I open my application iOS使用应用中的给定关键字打开iTunes音乐搜索 - iOS open iTunes music search with given keywords from app 是否还有办法在 iTunes Store 而不是 Apple Music 中打开 iTunes 搜索 API trackViewUrl? - Is there still a way to open an iTunes search API trackViewUrl in iTunes Store and not Apple Music? 在Swift中链接到iTunes音乐 - Link to iTunes Music in Swift 为什么当打开 iTunes App Store url 出现时,web 视图中的取消按钮不起作用。 (为了理解) - why does the cancel button in web view do not work when open iTunes App Store url appears. (for understanding) “您的请求无法完成”-iTunes网址错误 - “Your request could not be completed” - iTunes url error (iOS) 有没有办法让应用程序打开 iTunes 音乐播放器应用程序(最好直接进入“正在播放”屏幕)? - (iOS) Is there a way for an app to open the iTunes music player app (preferably going straight to the Now Playing screen)? Itunes API的音乐商店列表 - Itunes api for music store list MPMediaPickerController中的iTunes Music Match文件 - iTunes Music Match files in MPMediaPickerController AVAudiosession 播放 iTunes 库音乐? - AVAudiosession to play itunes library music?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM