I working with it for two days... I want get remote xml then parse/map it to core data. I have read bunch of tutorials, so at this moment I can connect with local server (yyuupii!), get xml, but I have problem with mapping. I get
-[RKObjectLoader canParseMIMEType:] Unable to find parser for MIME Type 'application/xml'
-[RKObjectLoader isResponseMappable] Encountered unexpected response with status code: 200 (MIME Type: application/xml -> URL: http:///list.xml -- http:/// -- http:/// -- http:///) 2012-10-24 14:13:12.201 Sierpien[4650:907] Error Domain=org.restkit.RestKit.ErrorDomain Code=4 "The operation couldn’t be completed. (org.restkit.RestKit.ErrorDomain error 4.)"
Could you gave me some advice I will be thankful.
My XML
<packs>
<pack>
<cover>cover.png</cover>
<info>Jakis.adres.pl</info>
<link>Opis</link>
<name>wrzesień</name>
<price>5.00</price>
</pack>
<pack>
<cover>cover2.png</cover>
<info>Jakis1.adres.pl</info>
<link>Opis31</link>
<name>wrzesień12</name>
<price>15.00</price>
</pack>
</packs>
My Entity
@interface Pack : NSManagedObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSString * link;
@property (nonatomic, retain) NSString * price;
@property (nonatomic, retain) NSString * info;
@property (nonatomic, retain) NSString * cover;
@end
My Implementation
- (id)initClient
{
self = [super init];
if (self) {
RKObjectManager *client = [RKObjectManager objectManagerWithBaseURL:[RKURL URLWithString:@"http://10.1.1.5:8888/"]];
NSLog(@"I am your RKObjectManager singleton : %@", [RKObjectManager sharedManager]);
client.serializationMIMEType = RKMIMETypeXML;
RKObjectMapping* listMapping = [RKObjectMapping mappingForClass:[Pack class]];
[listMapping mapKeyPath:@"cover" toAttribute:@"cover"];
[listMapping mapKeyPath:@"name" toAttribute:@"name"];
[listMapping mapKeyPath:@"info" toAttribute:@"info"];
[listMapping mapKeyPath:@"link" toAttribute:@"link"];
[listMapping mapKeyPath:@"price" toAttribute:@"price"];
[[RKObjectManager sharedManager].mappingProvider setMapping:listMapping forKeyPath:@"packs.pack"];
}
return self;
}
- (void)loadPacks {
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/list.xml" delegate:self];
}