I am having a problem displaying images from a JSON URL. I want to concatenate two strings to display images from the JSON URL, but I got an error in the console and I am not able to display the images.
JSON:
{
"status": "200",
"requestType": "bannerImages",
"basePath": "http:\/\/192.168.0.33\/cartwebsite3\/",
"bannerPath": "http:\/\/192.168.0.33\/cartwebsite3\/cdn-images\/banner\/",
"response": {
"data": [{
"banner_id": "40",
"banner_name": "14613036182de40e0d504f583cda7465979f958a98.jpg",
"banner_link": "",
"banner_blocked": "0",
"banner_created": "admin",
"created_on": "1461303618"
}, {
"banner_id": "39",
"banner_name": "1461303615f99687dd719c4e8bc6a39e946c3d9ef7.jpg",
"banner_link": "",
"banner_blocked": "0",
"banner_created": "admin",
"created_on": "1461303615"
}, {
"banner_id": "38",
"banner_name": "14613036094efdd2f969559e8b1c92e99f32ded48e.jpg",
"banner_link": "",
"banner_blocked": "0",
"banner_created": "admin",
"created_on": "1461303609"
}]
},
"request": {
"postData": [],
"getData": {
"type": "bannerImages",
"result": "json"
}
}
}
Code:
NSArray * arr1 = [json objectForKey: @ "bannerPath"];
NSLog(@ "%@", arr1);
NSMutableArray * arr2 = [json objectForKey: @ "basePath"];
NSLog(@ "%@", arr2);
[statusarray addObject: outstatus];
[ban_path_arr addObject: arr1];
[ban_base_arr addObject: arr2];
[bannerPath_NameArr addObject: [NSString stringWithFormat: @ "%@%@", arr1, banname]];
NSLog(@ "%@", bannerPath_NameArr);
Console Error
2016 - 05 - 02 10: 13: 31.173 pageview[949: 22534]( "http://192.168.0.33/cartwebsite3/cdn-images/banner/(\n
\"14613036182de40e0d504f583cda7465979f958a98.jpg\",\n
\"1461303615f99687dd719c4e8bc6a39e946c3d9ef7.jpg\",\n
\"14613036094efdd2f969559e8b1c92e99f32ded48e.jpg\"\n)" )
I got an error like this \n also display unnecessary. I don't know why it is display in URL images.
How can I solve this problem?
bannameassignment, but it looks like it is the whole array ofbanner_namevalues (e.g.valueForKey:@"banner_name"rather than looping through the values indata). But until you show us how you createdbanname, we can't help.