3

As per requirement I need to post user profile details like user name, first name, last name and profile picture from IPhone device. How can we send these details including “profile picture” together? Do I need to send these details as a JSON object? So I need to convert the image as byte array. Right?

If you can provide any IPhone code snippet then it would be better. Also if possible please provide the code for WCF Rest service Part.

Thanks in advance.

Ranish
  • 877
  • 2
  • 10
  • 30
  • check out these 2 tutorials by raywenderlich may help you.. http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app and http://www.raywenderlich.com/2965/how-to-write-an-ios-app-that-uses-a-web-service – vishy Nov 20 '12 at 06:19

1 Answers1

3

To send data to the server in JSON format:

ADD:

  1. JSON.h (Header)

  2. JSON.m (Implementation)

Use https://github.com/stig/json-framework/download

To convert your profile details, you can refer following sample

NSMutableDictionary *jsonEncode = [NSMutableDictionary dictionary];
[jsonEncode setValue:@"" forKey:@""];  
NSString *jsonString = [jsonEncode JSONString];

To send Image to server you need to convert image into Base64 format. Refer link below:

UIImage to base64 String Encoding

Community
  • 1
  • 1
Shekhar Gupta
  • 6,206
  • 3
  • 30
  • 50