Hi all,

I have Googled this issue for hours and tried various solutions suggested at 
Stackoverflow, but can't seem to solve the following problem.

I am pulling JSON from here: 
http://www.tenhorses.com/apps/meijburg/dotTAXDataHandler/dotTAXtaxNotesAPI.php

Both JSONLint, http://jsonformatter.curiousconcept.com and freeformatter.com 
say this is valid JSON.

I am using the NSURLConnection delegate methods (appending data as it comes in 
to a NSMutableData object) and are  serialising the downloaded data in the 
didFinishLoading like so:

    NSError *error;
    id jsonObject = [NSJSONSerialization JSONObjectWithData:self.container 
options:NSJSONReadingAllowFragments error:&error];
    if (error) {
        NSLog(@"ERROR: %@", error);
    }
    else {
        if ([self.type isEqual:@"people"] || [self.type isEqual:@"projects"] || 
[self.type isEqual:@"taxNotes"]) jsonObject = [jsonObject 
objectForKey:@"items"];
        NSString *notificationName = [NSString 
stringWithFormat:@"%@DataDownloaded", self.type];
        [[NSNotificationCenter defaultCenter] 
postNotificationName:notificationName object:nil userInfo:[NSDictionary 
dictionaryWithObject:jsonObject forKey:@"jsonArray"]];
        [sharedConnectionList removeObject:self];
    }


In short this sends off a notification with a pointer to an NSArray in case the 
downloader object's type is 'people', projects' or 'taxNotes' and to a 
NSDictionary in other cases.

Now here is the problem: although the JSON parses fine and populates a 
UITableView without any issues, I am still getting the following error:

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. 
(Cocoa error 3840.)" (Garbage at end.) UserInfo=0xa2329a0 
{NSDebugDescription=Garbage at end.}

I tested by creating an NSString from the data object and adding a few 
characters at the end. Never does that reveal anything that should be there at 
the end of the JSON string.

This, in itself, is slightly unsettling, but not critically wrong..

Has anybody here experienced a similar issue?

If so, can you tell me how to fix this?

Many thanks,

Diederik


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to