2011-05-13 167 views

回答

0

你應該能夠讓你嘗試播放曲目GET請求:

[api performMethod:@"GET" 
     onResource:@"tracks" 
    withParameters:[NSDictionary dictionaryWithObject:@"12821506" forKey:@"ids"] 
      context:context userInfo:nil]; 

然後,您可以註冊一個SCSoundCloudAPIDelegate和實施:

- (void)soundCloudAPI:(SCSoundCloudAPI *)soundCloudAPI 
    didFinishWithData:(NSData *)data 
       context:(id)context 
      userInfo:(id)userInfo; 

如果上下文等同於您在進行GET請求時傳入的上下文,您知道您的請求已完成。你可以建立一個NSDictionary造型的響應,然後搶流URL的流:

NSDictionary *trackInfo = [data objectFromJSONData]; 
NSString *steamURL = [trackInfo objectForKey:@"stream_url]; 

,你可以做的GET請求,請here時指定參數的完整列表。

+0

如何在第一種方法中實例化api對象? – 2011-06-07 12:34:40

相關問題