Search code examples
objective-cjsonhttpsgetafnetworking

Get Method is not working inside App if URL contains .info?


I am making a simple GET Method inside the APP , But its Not Working on some URL..

For Eg :

https://lievensberg.webcamconsult.com/wachtkamer/ZwXIk9KcYvMBFeJWiSeUQQ.json . - this is working (contains .com)

https://soa-webcamconsult.sense.info/wachtkamer/pk3rs51FpFUQkrHOJ0uBHg.json - this is not working (contains .info)

Both URL is Working Perfect in Browser...!

I am using AFNetworking, Any one can Help Me Please ? This is the Call Method , Url given below

//https://soa-webcamconsult.sense.info/wachtkamer/pk3rs51FpFUQkrHOJ0uBHg.json

  NSDictionary *header = [NSDictionary dictionaryWithObjectsAndKeys:@"application/json",@"Content-Type", @"application/json", @"Accept", @"iPhone",@"User-Agent",nil];

NSLog(@"url---%@",url);

NSLog(@"header---%@",[Utilities printJson:header]);


[SSNetworkClient initServerCallWithURL:url requestMethod:SSRequestMethodGET requestSerialize:YES headers:header imageData:nil imageDataName:nil parameters:nil success:^(id object) {
    completionBlock(YES,object);

} failure:^(id object) {
    failureCompletion(NO,object);

}];

Solution

  • In you response of second url you are getting invalid json and which should be like this,

    {
        "status": {
            "code": "on_time",
            "message": "U bent op tijd",
            "content": "Uw afspraak begint om *|afspraak_tijd|* ."
        },
        "slave": {
            "name1": "Dhr. sunny",
            "name2": "Meneer sunny"
        },
        "master": {
            "name1": "Mr beheerder"
        },
        "push": {
            "origin": "pubsub.pubnub.com",
            "pub_key": "pub-c-a6ca4c51-0a6f-475d-8f93-f53f48ba117b",
            "sub_key": "sub-c-97578f62-3587-11e3-be49-02ee2ddab7fe",
            "uuid": "sunny-5a323ac22cacff0004c2a717",
            "channels": ["5a29524f2b4faa000470384a", "5a323ac22cacff0004c2a717"]
        },
        "lobby_message": "",
        "contact_info": "/dyncontent/pk3rs51FpFUQkrHOJ0uBHg"
    }
    

    Above is the correct json which you will need to improve in your api response

    And if you wont verify just create the json file with above json it will work perfectly with browser and with your .info api response json it won't work so you need to improvise your .info json file response

    My Mozilla browser Quantum versionenter image description here response,