0
NSDictionary *parameters=[[NSDictionary alloc]initWithObjectsAndKeys:@"1",@"brand.brand_id",
                               @"1",@"city.city_id",
                               @"9911223344",@"mobile",
                               @"aravind",@"first_name",
                               @"Buddarapu",@"last_name",
                               @"anand@gmail.com",@"email",
                               @"21-12-1991",@"date_of_birth",
                               @"Male",@"gendername",
                               @"0",@"isadmin",
                               @"1",@"location.location_id",
                               @"1",@"organization.organization_id",
                               @"helloIndia",@"passwordhash",
                               @"1",@"preference.preference_id",
                               @"1",@"state",
                               @"BAnand",@"username",
                               @"",@"verifypass",nil];


    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    AFJSONRequestSerializer *serializer = [AFJSONRequestSerializer serializer];
    [serializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [serializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    manager.requestSerializer = serializer;


    [manager POST:@"http://*.***.**.***:****/SaveCustomer" parameters:parameters success:^(NSURLSessionDataTask *  task, id   responseObject) {

        NSLog(@"Responce is :%@",responseObject);


        } failure:^(NSURLSessionDataTask *  task, NSError *  error) {
        NSLog(@"error %@",error);
    }];

   }

While calling server am getting this error.

error Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

Sushil Sharma
  • 2,321
  • 3
  • 29
  • 49
  • Check out this link : http://stackoverflow.com/a/14171349/3378413 – Mihir Oza Nov 27 '15 at 07:03
  • Possible duplicate of [get responseObject on failure block AFNetworking 3.0](http://stackoverflow.com/questions/35083273/get-responseobject-on-failure-block-afnetworking-3-0) – Xavi López Mar 16 '16 at 13:44

1 Answers1

0

This can often be a result of your return data not being JSON encoded. Try encoding your data returned from the server to JSON format.

Webby
  • 43
  • 1
  • 5