views:

40

answers:

1

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 sharedApplication] 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

A: 

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=%@".

AlexVogel