0
我想從捲曲web服務的數據,但我的代碼是不工作我想分析從目標C捲曲基地web服務數據圖像和我使用的代碼
NSURL *url = [NSURL URLWithString:delegate.profilePic]; NSMutableURLRequest *req = [[NSMutableURLRequest alloc] initWithURL:picUrl]; [req setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [req setValue:@"application/octet-stream" forHTTPHeaderField:@"Content-Type"]; NSString *token =delegate.Token; [req setValue:token forHTTPHeaderField:@"X-Auth-Token"]; [req setHTTPMethod:@"GET"]; NSError *error = nil; NSURLResponse *response; NSData *urlData=[NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error]; NSString *myString = [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]; NSLog(@"Url Data %@",myString);
這是非常好的代碼!有什麼問題 ? –
對於初學者,您錯過了這行代碼的末尾:'NSURL * picUrl = [NSURL URLWithString:@「'。請修復它,以便我們可以嘗試提供幫助。 – neilco