thorpedosg

Untitled

Jul 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //
  2. // - performSearchOperation:
  3. //
  4. - (void) performSearchOperation:(HGSCallbackSearchOperation *)operation
  5. {
  6. HGSQuery * query = [operation query];
  7. NSString * queryString = [[query tokenizedQueryString] originalString];
  8.  
  9. if (!(search_ = [[JKPSpotifySearch alloc] initWithQuery:queryString]))
  10. {
  11. [operation finishQuery];
  12. return;
  13. }
  14.  
  15. [search_ beginSearchWithCompletionHandler:
  16. ^(NSDictionary * results, NSError * error)
  17. {
  18. if ([operation isCancelled])
  19. return;
  20.  
  21. if (error != nil)
  22. NSLog(@"Spotify query failed: %@",
  23. [[error userInfo] valueForKey:kJKPSpotifySearchErrorReasonKey]);
  24. else
  25. [operation setRankedResults:[self processResults:results
  26. forQuery:query]];
  27. [operation finishQuery];
  28. }];
  29. }
Add Comment
Please, Sign In to add comment