Comments (5)
Hey, to be honest you shouldn't really see assertions. Are you using the current head commit ? I think this is error that happened when subobject didn't exist altogether. Can you confirm it's still happening on current head of the branch?
from propertymapper.
Ok, I switched from the 2.0 release to the current head (commit 93e2ec3). Seems to be the same problem.
2013-11-10 11:00:18.412 Passions[21284:70b] **\* Assertion failure in +[KZPropertyMapper validateMapping:withValuesArray:], /Users/simon/Documents/code/ObjC/GitHub/KZPropertyMapper/KZPropertyMapper/KZPropertyMapper.m:193
2013-11-10 11:00:18.422 Passions[21284:70b] **\* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid condition not satisfying: [key isKindOfClass:NSNumber.class]'
**\* First throw call stack:
(
0 CoreFoundation 0x01d5f5e4 **exceptionPreprocess + 180
1 libobjc.A.dylib 0x01ae28b6 objc_exception_throw + 44
2 CoreFoundation 0x01d5f448 +[NSException raise:format:arguments:] + 136
3 Foundation 0x00657fee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 Passions 0x000528db __52+[KZPropertyMapper validateMapping:withValuesArray:]_block_invoke + 363
5 CoreFoundation 0x01de840c __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 76
6 CoreFoundation 0x01de832e -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 238
7 CoreFoundation 0x01d4d525 -[NSDictionary enumerateKeysAndObjectsUsingBlock:] + 53
8 Passions 0x000526ac +[KZPropertyMapper validateMapping:withValuesArray:] + 284
9 Passions 0x00052526 +[KZPropertyMapper validateMapping:withValues:] + 854
10 Passions 0x000530a6 __57+[KZPropertyMapper validateMapping:withValuesDictionary:]_block_invoke + 342
11 CoreFoundation 0x01de840c __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 76
12 CoreFoundation 0x01de832e -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 238
13 CoreFoundation 0x01d4d525 -[NSDictionary enumerateKeysAndObjectsUsingBlock:] + 53
14 Passions 0x00052e96 +[KZPropertyMapper validateMapping:withValuesDictionary:] + 278
15 Passions 0x000524e9 +[KZPropertyMapper validateMapping:withValues:] + 793
16 Passions 0x0004f646 +[KZPropertyMapper mapValuesFrom:toInstance:usingMapping:errors:] + 182
17 Passions 0x0004f528 +[KZPropertyMapper mapValuesFrom:toInstance:usingMapping:] + 184
18 Passions 0x0005584b -[LFMAlbumInfo initWithJson:] + 2635
19 Passions 0x0005ea22 __57-[LastFmFetchr getInfoForAlbum:byArtist:mbid:completion:]_block_invoke_2 + 146
20 Passions 0x0005f96a -[LastFmFetchr handleRequestSuccess:task:methodParamValue:jsonContentKey:success:failure:] + 1066
21 Passions 0x0005e90b __57-[LastFmFetchr getInfoForAlbum:byArtist:mbid:completion:]_block_invoke + 363
22 Passions 0x00017697 __55-[AFHTTPSessionManager GET:parameters:success:failure:]_block_invoke + 231
23 Passions 0x0003a375 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2 + 213
24 libdispatch.dylib 0x0295d7f8 _dispatch_call_block_and_release + 15
25 libdispatch.dylib 0x029724b0 _dispatch_client_callout + 14
26 libdispatch.dylib 0x0296075e _dispatch_main_queue_callback_4CF + 340
27 CoreFoundation 0x01dc4a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE** + 14
28 CoreFoundation 0x01d056bb __CFRunLoopRun + 1963
29 CoreFoundation 0x01d04ac3 CFRunLoopRunSpecific + 467
30 CoreFoundation 0x01d048db CFRunLoopRunInMode + 123
31 GraphicsServices 0x02f629e2 GSEventRunModal + 192
32 GraphicsServices 0x02f62809 GSEventRun + 104
33 UIKit 0x00c75d3b UIApplicationMain + 1225
34 Passions 0x0000258d main + 141
35 libdyld.dylib 0x02c0470d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
from propertymapper.
Can you share the source dictionary and mapping you are using so that I can reproduce it?
from propertymapper.
Sure. I created a short class which produces the error. Call it using [[LFMTesting alloc] initForTesting];
. It breaks down in KZPropertyMapper:185 where it falsely assumes that values is an array. It is not an array because the API returns a white space String when there is no data instead of an array, as it does when there is data.
from propertymapper.
BTW: I found a workaround. I use the mapping
@"toptags" : KZCall(tagsFromDictionary:, topTags)
and catch the empty case in my tagsFromDictionary:
.
from propertymapper.
Related Issues (20)
- Update CocoaPods with the latest commit HOT 2
- Asserts when receiving an NSArray instead of an NSDictionary HOT 3
- No testing of validation errors in KZPropertyMapperValidatorTests.m HOT 5
- Crash when creating the date formatter
- Support for Swift HOT 1
- CocoaPods and 2.5.1? HOT 1
- KZCall on different object? HOT 4
- Doesn't work when there's a getter method defined HOT 2
- Support for compound property? HOT 4
- Support for NSEntityDescription instance HOT 2
- Nullify value for missing key/default value HOT 1
- ISO 8601 date format HOT 1
- Ability to Propagate Errors when using Custom Boxing / Call HOT 3
- No mapping if value from custom boxing is nil HOT 7
- Suppressing error messages HOT 4
- Crash when converting from number to NSDate HOT 2
- Crash when mapping null object to a primitive HOT 1
- validationErrors array is always null HOT 2
- Better warning message for missing Box custom methods HOT 1
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 propertymapper.