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
Quick start problem #14
Comments
I guess the problem was that I needed to import the fields I was planning to use as primarykey, so:
kinda fixed the problem. However i have a question: how to deal with JSON parameters like "chrNum":"23" which FEM expects to be NSNumber? 2014-10-06 11:30:23.374 Exome Scan[6395:360f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "chrNum"; desired type = NSNumber; given type = __NSCFString; value = 1.' Thanks |
Sorry, out of laptop for about a week. Take a look at custom FEMAttributeMapping: in map & reverse map you can specify your custom mapping. I.e. Map: ^(id value) { // check whether it is a nsstring; return [value integerValue]; } |
thank you very much, I'll look at it. |
Honestly I didn't understand, I'm sorry. Is there any documentation available? Thank you very much for help. |
@superandrew [mapping addAttributeMapping:[FEMAttributeMapping mappingOfProperty:@"chrNum" toKeyPath:@"chrNum" map:^id(id value) {
return [value isKindOfClass:NSString.class] ? @([value integerValue]) : NSNull.null;
} reverseMap:^id(NSNumber *value) {
return [value stringValue];
}]]; |
You don't have to sorry, It's a gift that this project exists. Thank you very much for your passion and commitment. |
Ok, so I understood how this work, but exactly what do exactly "map" and "reverseMap" means by a semantic perspective? They are two blocks which should do exactly which kind of operation? reverseMap seems to convert the actual value to the expected class, but it's not clear for "map". I'm sorry, maybe it's really simple but I just don't get it :( |
@superandrew |
The core idea behind it is to provide flexible way of mapping JSON input into any kind of data you'd like to and vice versa. Take a look at +[FEMAttributeMapping mappingOfProperty:toKeyPath:dateFormat:] to understand, what you can do with all those blocks |
@superandrew do you need any help to this question? |
Everything is clear, thank you very much. |
Hello, I am having trouble setting ap FEM.
This is my code:
And how I call it:
Chromosome *c = [FEMManagedObjectDeserializer deserializeObjectExternalRepresentation:chr usingMapping:[MappingProvider chromosomeMapping] context:_setupContext];
I have this error
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: primaryKeyMapping'
*** First throw call stack:
(
0 CoreFoundation 0x000000010dbca495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d92499e objc_exception_throw + 43
2 CoreFoundation 0x000000010dbca31a +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010d4bbf19 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 Exome Scan 0x000000010c8676a2 -[FEMCache inspectObjectRepresentation:usingMapping:] + 450
Any idea?
The text was updated successfully, but these errors were encountered: