我想轉換數據庫中的圖像以在我的iAd應用程序中檢索它,爲了做到這一點,我使用了JSON,但是我沒有正確地完成它。如何解析iPad應用中的JSON字符串?
在我的按鈕onTouch如果你的目標iOS 5中我寫了這個代碼
//create string contain url address for php file, the file name is phpFile.php,it receives parameter :name
NSString *strURL=[NSString stringWithFormat:@"....my.php","hhhhh"];
//to execute php code
NSData *dataURL=[NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
//to receive the returned Result
NSString *strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding]self];
NSLog(@"%@",strResult);
你能詳細您已經嘗試什麼,你的代碼? – aqua 2012-01-13 08:55:06
我的按鈕onTouch裏面我寫了這段代碼 //創建字符串包含php文件的url地址,文件名是phpFile.php,它接收參數:name NSString * strURL = [NSString stringWithFormat:@「http:// WWW ..... my.php」, 「HHHHH」]; //執行php代碼 NSData * dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]]; //收到返回的結果 NSString * strResult = [[[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding] self]; NSLog(@「%@」,strResult); – Karna 2012-01-13 09:08:26
我想分析這一點,並從上面的字符串獲取所有細節,然後顯示所有這些在我的應用程序 – Karna 2012-01-13 09:13:57