Questions tagged [github-mantle]

Model framework for Cocoa and Cocoa Touch by GitHub

Mantle is a model framework for Cocoa and Cocoa Touch created and maintained by Justin Spahr-Summers at GitHub.

Mantle allows developers to quickly and easily write a simple model layer for their applications by providing them such tools, as:

  • Automatic two-way JSON serialization
  • Automatic two-way NSManagedObject serialization
  • Exception handling
  • Versioning support

Resources:

Questions tagged under should be directly connected with Mantle. If your project is using Mantle but the question is not connectet with it, don't add this tag to yor question.

91 questions
0
votes
1 answer

Mantle: Uncaught exception 'NSInvalidArgumentException' when parsing JSON

I am using the Mantle framework, and I seem to be having some problems with serializing some values into a MTLModel. This is the JSON I am receiving from the server: { "id":50, "name":"UserName", "email":"user@username.com", …
AndyRoid
  • 5,062
  • 8
  • 38
  • 73
0
votes
2 answers

How to use an NSArray not key-value pair with Mantle

If I have a JSON array like this, { "list": [ "javascript", "stockFields", "stockLists" ] } and two models like: @interface stockList : MTLModel @property(nonatomic, copy, readonly) NSArray…
SimonKira
  • 91
  • 1
  • 4
  • 13
0
votes
2 answers

Mantle modelOfClass json parsing

I have the following Mantle object & want to convert the dictionary to Mantle object. but the conversion always returns empty MTLModel object. Any ideas? //ABC.h @interface ABC : MTLModel @property (nonatomic, strong) NSString…
Punnaghai
  • 1
  • 2
0
votes
1 answer

Mantle - Transform String to Enum Value

In my User class, I have defined a type property and a UserType enum. The type property is received as a String value in the JSON: { "type" : "Admin" } I would like to use Mantle to transform the String value into a UserType enum object and…
Alexander
  • 3,959
  • 2
  • 31
  • 58
0
votes
1 answer

Mantle 2.0 cannot parse JSON for the notation in array nested

The following codes parsing JSON don't work any more for me after I update Mantle to 2.0. They can work fine on an older Mantle version( I don't remember the correct version number. What I know is I downloaded it in Nov of 2013.) Here is the JSON…
0
votes
0 answers

unable to map keyless json with mantle (properly)

I am trying to find a way to parse my json array properly. I was unable to figure out a good solution to parse my json object using mantle. I was able to find information on parent child objects but not on holding a collection of keyless objects. My…
Matt
  • 674
  • 11
  • 25
0
votes
1 answer

Mantle issue - MTLValueTransformer won't transform an NSNumber to an int

I'm using Mantle to successfully transform values in my model - but this one comes back with the error: Incompatible block pointer types sending 'int (^)(NSNumber *__strong)' to parameter of type 'MTLValueTransformerBlock' (aka 'id (^)(__strong…
H K
  • 1,215
  • 2
  • 16
  • 29
0
votes
1 answer

Map NSArray with timestamps to NSDate objects with Mantle in iOS

For example, I have an MTLModel subclass Order with properties @property (nonatomic, copy) NSArray *dates; @property (nonatomic, strong) NSDate *dateFrom; @property (nonatomic, strong) NSDate *dateTo; JSON that comes from server looks like: …
alex
  • 2,121
  • 1
  • 18
  • 24
0
votes
2 answers

get subTree of JSON using github-mantle

I'm trying to get the subnodes of a JSON file usning githubs mantle. This is what I tried: JSON "countries": { "name": "germany", "population": "80620000000", "populationInCities": { "Hamburg": 1799000, …
Michael
  • 1,030
  • 14
  • 29
0
votes
1 answer

Mantle and Core Data - Could not serialize managed object

I am trying to store a JSON into Coredata using Mantle and I have the following code: PPCoreDataStack *coreDataStack = [PPCoreDataStack defaultStack]; //my custom wrapper for CoreData a simple accessor really NSManagedObject *mob =…
Obaid
  • 4,328
  • 9
  • 42
  • 42
0
votes
1 answer

Error testing a Mantle model on iOS

Given the following simple model class (based on Mantle): // .h #import @interface JAIInterestingPhonesCategory : MTLModel @property (copy, nonatomic, readonly) NSString *categoryId; @property (copy, nonatomic,…
Sendoa
  • 4,705
  • 5
  • 27
  • 21
0
votes
2 answers

How to get YapDatabase and Mantle to play nicely with serialization

Suppose I have a model like this: #import #import "MyCustomObject.h" @interface MyModel : MTLModel @property (nonatomic, copy, readonly) NSString *UUID; @property (nonatomic, copy) NSString *someProp; @property…
chasew
  • 8,438
  • 7
  • 41
  • 48
0
votes
0 answers

Create custom NSString from JSON Array using Mantle

I am using Mantle to parse some business JSON. At present we go through an array of JSON objects for the business categories with the following: NSMutableString *stringCats = [[NSMutableString alloc] init]; for (NSArray *cats in…
StuartM
  • 6,743
  • 18
  • 84
  • 160
-1
votes
2 answers

mantle - How to write value transformer for a dictionary

I have this response from an API and trying to find ways to map this to an NSDictionary using a Mantle value transformer. { "baggage": { "BAG10": "3.5", "BAG15": "3.5", "BAG20": "3.5", "BAG30": "3.5", "BAG40": "3.5" …
melaka
  • 699
  • 7
  • 23
-1
votes
2 answers

In this case, how to map this json to model?

Here is a json: { query_list: [ { restaurant: {}, foods: [ food1: {}, food2: {} ] }, { restaurant: {}, foods: [ food3: {}, food4: {} ] } ], url: "" } I want…
merito
  • 465
  • 4
  • 15