[英]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.