0

I get an error while I send Json data to server. I used the following code to change the NSMutableDictionary To JSON.

NSString* jsonString1 = [postDict JSONRepresentation];
NSLog(@"%@",jsonString1); 

JSON Format:

         {"user_email":"[email protected]","firstname":"nivrit","user_password":"1234","confirm_passward":"1234"}

I use the following method to send this JSON format to server:

NSMutableDictionary *responseDict = 
    (NSMutableDictionary *)[[mWebServiceHelperOBJ 
              makeCallToURL:@"register.php" 
              withDataPost:jsonString1] JSONValue];

When I implemented this code I received this issue

incompatible pointer type sending  NSString to parameter of type  NSMutableDictionary.
1
  • It would be nice to know why you "unaccepted" my answer ... Commented Oct 15, 2013 at 10:54

1 Answer 1

1

If your method

- (NSString *)makeCallToURL:(NSString*)url withDataPost:(NSMutableDictionary*)dict;

is the same as in this question: Uploading PDF file through JSON Web Service, then the JSON encoding of the request data is done inside that method, so you should call it directly with the postDict, and not with the JSON string jsonString1:

NSMutableDictionary *responseDict = 
    (NSMutableDictionary *)[[mWebServiceHelperOBJ makeCallToURL:@"register.php" 
                                                   withDataPost:postDict] JSONValue];

(This assumes that postDict is an NSMutableDictionary.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.