0
A
回答
1
你必須使用NSUrlConnection
這項工作。 SO已經有了一個很好的解釋Question 必須設置你的JSON數據的HTTP主體在NSUrlRequest
也有其他包諸如ASIHTTPRequest(拋棄,但現在廣泛使用的也可以),RestKit等
0
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:requestUrlString]];
NSMutableDictionary *dict1 =[[NSMutableDictionary alloc] init];
if ([m_ProductInfoDictonary objectForKey:@"TOKEN"] != nil) {
[dict1 setObject:[mAppDelegate.m_ProductDictonary objectForKey:@"TOKEN"] forKey:@"token"];
NSMutableDictionary *dict2 =[[NSMutableDictionary alloc] init];
[dict2 setObject:[mAppDelegate.m_ProductDictonary objectForKey:@"PRODUCTNAME" ] forKey:@"title"];
[dict2 setObject:[mAppDelegate.m_ProductDictonary objectForKey:@"DESCRIPTION" ] forKey:@"description"];
[dict2 setObject:[mAppDelegate.m_ProductDictonary objectForKey:@"PRODUCTPRICE" ] forKey:@"price"];
[dict2 setObject:[mAppDelegate.m_ProductDictonary objectForKey:@"ZIPCODE" ]forKey:@"zipcode"];
NSMutableDictionary *dict =[[NSMutableDictionary alloc] init];
[dict setObject:dict2 forKey:@"item"];
[dict setObject:dict1 forKey:@"user"];
//[dict setObject:dict3 forKey:@"item_images"];
[dict1 release];
[dict2 release];
[request setPostValue:[dict JSONRepresentation] forKey:@"item_post"];
[request setPostFormat:ASIMultipartFormDataPostFormat];
[request setTimeOutSeconds:200];
[request setDelegate:self];
[request setDidFinishSelector:@selector(uploadRequestFinished:)];
[request setDidFailSelector:@selector(uploadRequestFailed:)];
[request startSynchronous];
[requestUrlString release];
相關問題
- 1. [Android] -POST Json with HttpUrlConnection
- 2. HTTP Post with Matlab
- 3. Php with AJAX Post - 返回值JSON
- 4. Groovy ws-lite REST post with json payload
- 5. Http Post with indy
- 6. Submit Post with PRAW
- 7. Angularjs with Post requests
- 8. Subrequests with post vars
- 9. Post with HTTPUrlConnection
- 10. Post with WebRequest
- 11. http post with flash?
- 12. HTTP POST with HttpWebRequest
- 13. PHP Post file with file_get_contents
- 14. Asp Core Ajax Post with ViewModel
- 15. select2 with ajax post方法
- 16. FullCalendar with JSON feed slowloading
- 17. HttpClient post with Content-Disposition
- 18. PHP Post with Square Brackets
- 19. angular $ http post with headers
- 20. PHP POST WITH DATATABLE PAGINATION
- 21. youtube video post with php
- 22. jQuery document.ready with ajax $ .post
- 23. curl with nodejs express - POST數據
- 24. POST multipart/form-data with Guzzle 4
- 25. Http Post with node.js and express
- 26. Mule ESB -http:outbound-endpoint with post parameters
- 27. Http Post with Blackberry 6.0問題
- 28. Fetch Sol:r JSON with $ .ajax
- 29. Json with RabbitMQ
- 30. 發送JSON Post with robospice谷歌http客戶端
您問題不清楚。請添加更多內容。 – Cybermaxs