-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONkit with arrays and objectatindex #27
Comments
The If you could, could you please add to this bug report the JSON that was used / parsed that is causing this problem? Hopefully that will be enough for me to determine where things went wrong inside JSONKit and put together a fix for you. If it's not, I may need a bit more information from you. Also, are the arrays and dictionary in question mutable? And if so, are you performing mutating operations on them, such as adding or removing items? And since you are using a tableview, are you using a |
Also, could add the following just before line 745, where the if(!((objects != NULL) && (count <= capacity) && (objects[objectIndex] != NULL))) {
NSLog(@"objects: %p", objects);
NSLog(@"count: %ld, capacity: %ld", count, capacity);
NSLog(@"objectIndex: %ld, objects[objectIndex]: %p", objectIndex, (objects != NULL) ? objects[objectIndex] : NULL);
}
NSParameterAssert((objects != NULL) && (count <= capacity) && (objects[objectIndex] != NULL)); // Line 745 Then, run your app, and when the condition that causes the |
Thanks so much for the response, I really appreciate it! everything else seems great so far and i picked JSONkit for the performance. Ill get the info you asked for and reply in a bit. thanks again!! |
ok i was able to hover over the variables in the three part assertion...count shows as 25 as does capacity so okay there. you're right, objects might be the issue. hovering over it shows "id * objects 0x0" - where does this come from? NSloging shows me I have data in the arrays and dictionaries. not sure if i can provide JSON itself, but i can work on creating dummy one that exactly mimics it with fake data no mutable arrays or dictionaries. not using nsarraycontroller, should i be? i'll add the if you sent and run and send results next. thanks!! |
heres from the console, looks like objects is empty? 2011-05-27 15:52:25.272 navtest2[27134:207] objects: 0x0 |
That's very odd. - (void)dealloc
{
if(JK_EXPECT_T(objects != NULL)) {
NSUInteger atObject = 0UL;
for(atObject = 0UL; atObject < count; atObject++) { if(JK_EXPECT_T(objects[atObject] != NULL)) { CFRelease(objects[atObject]); objects[atObject] = NULL; } }
free(objects); objects = (void *)0xbadc0de; // Change from NULL to (void *)0xbadc0de.
}
[super dealloc];
} Also change line ~745, the same NSParameterAssert((objects != NULL) && (objects != (void *)0xbadc0de) && (count <= capacity) && (objects[objectIndex] != NULL)); This will allow the assertion to catch the fact that My suspicion is that you will make these changes, and |
Assuming that my hunch that this is a Some more memory debugging links: http://www.cocoadev.com/index.pl?NSZombieEnabled |
@skinsfan00atg, any update on this issue? Did it end up being a |
Sorry had family visiting will try tonight, thanks again! On May 30, 2011, at 4:57 AM, johnezangreply@reply.github.com wrote:
|
so sorry for the delay, it was a self. issue and now everything works great! |
Sorry to raise this again, but what do you mean by a self. issue? I'm experiencing the same problem. |
I'll double check my resolution when I get back to my work computer tomorrow On Nov 1, 2011, at 7:28 PM, Ben Hallreply@reply.github.com wrote:
|
I had the same problem, it was a retain/release problem for me. |
Had the same issue, I was trying to set the output straight to a dictionary I had created. solved it by setting the output to a temporary dictionary and making a copy JSONKit is a very nice tool I will continue to use it! |
BenHall, did you ever fix yours? |
Does JSONkit work with arrays? Ive got the following and using NSLogs I seem to have gotten my data correctly, but I am having some issues with tableview and the errors are new to me.
the feed is an array of dictionaries and I've been able to use nested objectForKey, valueForKey and objectATIndex messages to get to all the data I want. I've even gotten it displayed in my tableview when the app first opens. The problem is as soon as i try and scroll the app crashes.
In the code editor, I get "Thread 1: Program received signal: "SIGABRT" on a line in titleForHEaderInSection: return [[myArray objectAtIndex:section] valueForKey:@"key"]; I've got the following right above that and that outputs to the log correctly, so its something to do with the scrolling and going to the next section thats off screen: NSLog(@"classser %@", [[[industries objectAtIndex:section] valueForKey:@"industry"]description]);
In the console I get "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: (objects != NULL) && (count <= capacity) && (objects[objectIndex] != NULL)'". It takes me to line 745 of JSONKit.m which is an assertion in obejctatIndex ( NSParameterAssert((objects != NULL) && (count <= capacity) && (objects[objectIndex] != NULL)); ) I'm not adhering to, but I just don't know how as everything else I do shows my array and dictionaries as working.
Let me know what else you need as I'm still new to all this
The text was updated successfully, but these errors were encountered: