Obj C -- issues getting Spartan Image

Hi guys,

I’m building a Halo 5 stat app for my iOS class and have been able to retrieve Arena stats and Spartan emblems without any issue, however, when trying to get the Spartan image I am running into some strange errors. I am using the code from the documentation (commenting out the setHTTPBody method, which causes the request to fail).

When using NSJSONSerialization with the reading option NSJSONReadingMutableContainers I get this error:
Could not parse loaded json with error:Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set

So i tried serializing the JSON file using NSJSONReadingAllowFragments I get the following error:
Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0.

Also, when trying to convert the NSData to a string or NSMutableDictionary or NSMutableArray (I’ve tried both) using the following methods, both are set with nil.

Has anyone else encountered this issue? Any suggestions as to how I might resolve this issue? Any help would be greatly appreciated.

Thanks,
A fellow Spartan

Looks like the example documentation is wrong: you’ll get a image response, not a JSON response.

The Spartan Image endpoint is the same as the Emblem Image. Do what your doing to make the emblem work and it should be fine :slight_smile: