开发者

How to call itunes from my iphone app with search for a known CD

here is my code:

-(IBAction)itunesBuy:(id)sender{
    // NSString *urlString = [[NSString alloc] initWithFormat:@"http://itunes.com/%@/%@", self.artistTerm,self.titleTerm];
NSString *urlString = [[NSString alloc] initWithFormat:@"http://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?albumTerm=%@", self.titleTerm];


NSLog(@"urlString=%@", urlString);
NSString *escapedValue = [(NSString *)CFURLCreateStringByAddingPercentEscapes(nil,(CFStringRef)urlString,NULL,NULL,kCFStringEncodingUTF8) autorelease];

NSURL *itunesUrl = [NSURL URLWithString:escapedValue];
if (![[UIApplication sharedApplica开发者_开发技巧tion] openURL:itunesUrl])
    NSLog(@"%@%@",@"Failed to open url:",[itunesUrl description]);

 }

You can see that I tried the simpler itunes link as well. My understanding was that this won't work on the simulator, but should on the device.

On my iPad and my iPhone, it launches itunes, but then I get an error saying:"Your request could not be completed. This search cannot be performed on this device."

Any help would be appreciated.

Steve


There is no advanced search in device appstore, only in itunes on your Mac/PC. Try to use the simple search with "itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?term=%@".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜