Comments (15)
The NSInternalInconsistencyException
exception message is clearly generated by JSONKit- JSONKit has detected a condition which, if things are working correctly, "should not happen". Because the assertion check has multiple conditions that it checks, it's hard to tell exactly which one of the checks failed. If I had to guess, the most likely would be objects[objectIndex] != NULL
, which would translate in to prose "The array in question should have a valid object at this index, but for some unexpected reason it is NULL
".
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 NSArrayController
and/or bindings to display the contents of the array?
from jsonkit.
Also, could add the following just before line 745, where the NSAssertion
is:
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 NSAssertion
to fail, it should print out a bunch of info to the console that will help determine exactly what has gone wrong.
from jsonkit.
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!!
from jsonkit.
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!!
from jsonkit.
heres from the console, looks like objects is empty?
2011-05-27 15:52:25.272 navtest2[27134:207] objects: 0x0
2011-05-27 15:52:25.273 navtest2[27134:207] count: 25, capacity: 25
2011-05-27 15:52:25.273 navtest2[27134:207] objectIndex: 0, objects[objectIndex]: 0x0
from jsonkit.
That's very odd. objects
is the JKArray
(an internal JSONKit class) iVar that holds the pointer to the memory allocation where the objects in that array are kept. There are very few things that modify that variable- when the array is created, sometimes when it is mutated and needs to grow that allocation, and when the object is released. This makes me wonder if you might have accidently released the object but still have a reference to it. Can you try making the following modification (near line 717):
- (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 NSAssertion
that you originally reported, to the following:
NSParameterAssert((objects != NULL) && (objects != (void *)0xbadc0de) && (count <= capacity) && (objects[objectIndex] != NULL));
This will allow the assertion to catch the fact that objects
is set to 0xbadcode
instead of allowing it to pass through and cause a sig fault or something.
My suspicion is that you will make these changes, and objects
will be set to 0xbadcode
, and the only way that could happen is because you missed a -retain
somewhere.
from jsonkit.
Assuming that my hunch that this is a retain
/ release
issue, you might want to take a look at enabling NSZombieEnabled
. You can find information about how to enable it here.
Some more memory debugging links:
http://www.cocoadev.com/index.pl?NSZombieEnabled
http://developer.apple.com/library/mac/#technotes/tn2004/tn2124.html
http://developer.apple.com/library/mac/technotes/tn2004/tn2124.html#SECFOUNDATION
from jsonkit.
@skinsfan00atg, any update on this issue? Did it end up being a retain
/ release
problem, or do we still need to dig in to a possible problem with JSONKit?
from jsonkit.
Sorry had family visiting will try tonight, thanks again!
On May 30, 2011, at 4:57 AM, [email protected] wrote:
@skinsfan00atg, any update on this issue? Did it end up being a
retain
/release
problem, or do we still need to dig in to a possible problem with JSONKit?Reply to this email directly or view it on GitHub:
#27 (comment)
from jsonkit.
so sorry for the delay, it was a self. issue and now everything works great!
from jsonkit.
Sorry to raise this again, but what do you mean by a self. issue? I'm experiencing the same problem.
from jsonkit.
I'll double check my resolution when I get back to my work computer tomorrow
On Nov 1, 2011, at 7:28 PM, Ben [email protected] wrote:
Sorry to raise this again, but what do you mean by a self. issue? I'm experiencing the same problem.
Reply to this email directly or view it on GitHub:
#27 (comment)
from jsonkit.
I had the same problem, it was a retain/release problem for me.
from jsonkit.
Had the same issue, I was trying to set the output straight to a dictionary I had created.
myDictionary = [string objectFromJSONString];
solved it by setting the output to a temporary dictionary and making a copy
NSDictionary *tempDictionary =[string objectFromJSONString];
myDictionary = [tempDictionary copy];
JSONKit is a very nice tool I will continue to use it!
from jsonkit.
BenHall, did you ever fix yours?
from jsonkit.
Related Issues (20)
- Any popular replacement for JSONKit? HOT 2
- BSD two-clause or three-clause license? HOT 2
- crash at JSONKit.m:2598:77 HOT 2
- Error in serializing NSNumber HOT 2
- Supporting gzip decompression
- Swift HOT 7
- can not use with xcode 7 HOT 4
- Xcode 7 Before is use JSONKit in Object but now not use JSONKit in Xcode 7 HOT 7
- crash with iOS9 Xcode7 HOT 5
- Should be #import <JSONKit/JSONKit.h> or <GCJSONKit/JSONKit.h>? HOT 1
- please ignore
- Crash when NSDictionary to String json format. HOT 1
- about convert json to NSDictioanry (error if json string contains double field) HOT 7
- JsonKit message JSONDataWithOptions crashes in macOS Sierra HOT 1
- JSONKit Installation error in X-code 7.3.1 iOS 9.3 HOT 1
- iOS TRAP_TRACE crash
- JSONKit semantic issue after updating the pod HOT 3
- Tagged pointer format changes in iOS 14 break JSONKit on ARM64 HOT 8
- @serkrapiv Not necessarily verboten, just that they must be escaped. The first paragraph of 2.5 Strings says: HOT 1
- Yea
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonkit.