Ok, so here is my deal. I have an app I am building for a DJ service. They post gigs, people can view the gigs, and request songs. The DJ can view those requests, and click the song title and have an option to search Spotify for that song. I have to use the Spotify API to get the TRACK ID for that song, and I plug that in to an NSString, and then use a custom url scheme to open up Spotify straight to that track. Below is the code for all this. The issue is that on 9.3.3 it will open spotify and start playing the song. On iOS 10, nothing happens. Is this a bug in iOS 10 Beta 3, or did they change behavior for getting this to work with iOS 10?
[actionSheet addAction:[UIAlertAction actionWithTitle:@"Search Spotify" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
NSArray *separated = [wholeThing componentsSeparatedByString:@"Made-Famous-By"];
NSString *songTitle = [[separated objectAtIndex:0] stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *artistName = [[separated objectAtIndex:1] stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *theSong = [[@"%22" stringByAppendingString:songTitle] stringByAppendingString:@"%22"];
NSString *theArtist = [[@"%22" stringByAppendingString:artistName] stringByAppendingString:@"%22"];
NSURL *url = [NSURL URLWithString: [NSString stringWithFormat:@"https:/
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setURL:url];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSError *error;
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSDictionary *json = [NSJSONSerialization
JSONObjectWithData:data
options:kNilOptions
error:&error];
if(!error) {
NSDictionary *active = json[@"tracks"];
/
/
NSDictionary *dict1=[json objectForKey:@"tracks"];
NSArray *songTrack = [dict1 valueForKeyPath:@"items.uri"];
NSLog(@"%@", songTrack);
self.toOpen = [songTrack objectAtIndex:0];
NSLog(@"%@", self.toOpen);
/
/
}
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:self.toOpen]];
[self dismissViewControllerAnimated:YES completion:^{
}];
}]];