restkitを使用してxmlフィードを読み取ったり解析したりしようとしています。これには、ネストされたアーティストの配列が含まれています。他の関係をマッピングすることはできますが、以下のアーティストの関係をどうするかがわかりません。
私のデータセットは次のようになります:
<JamBase_Data>
<Results_Title>Jersey City, NJ</Results_Title>
<event>
<event_id>1896611</event_id>
<artists>
<artist>
<artist_id>96929</artist_id>
<artist_name>The Happy Problem</artist_name>
</artist>
<artist>
<artist_id>29817</artist_id>
<artist_name>Craig Greenberg</artist_name>
</artist>
</artists>
<event_date>1/9/2013</event_date>
<venue>
<venue_id>48553</venue_id>
<venue_name>The Cake Shop</venue_name>
<venue_city>New York</venue_city>
<venue_state>NY</venue_state>
<venue_zip>10002</venue_zip>
</venue>
<event_url>
http://www.jambase.com/Shows/Event.aspx?eventID=1896611
</event_url>
</event>
</JamBase_Data>
マッピング:
RKObjectMapping *eventMapping = [RKObjectMapping mappingForClass:[Event class]];
RKObjectMapping *artistMapping = [RKObjectMapping mappingForClass:[Artist class]];
RKObjectMapping *venueMapping = [RKObjectMapping mappingForClass:[Venue class]];
[artistMapping mapKeyPathsToAttributes: @"artist_name",@"artist_name", nil];
[venueMapping mapKeyPathsToAttributes: @"venue_city",@"venue_city",@"venue_state",@"venue_state", @"venue_name", @"venue_name", nil];
[objectManager.mappingProvider setMapping:eventMapping forKeyPath:@"JamBase_Data.event"];
[eventMapping mapKeyPath:@"artists" toRelationship:@"artists" withMapping:artistMapping];
[eventMapping mapKeyPath:@"venue" toRelationship:@"venue" withMapping:venueMapping];
Venue.h
@interface Event : NSObject
@property (nonatomic, strong) NSSet *artists;
@property (strong, nonatomic) Venue *venue;
@終わり
Artist.h
@interface Artist : NSObject
@property (nonatomic, strong) NSNumber *artist_id;
@property (nonatomic, strong) NSNumber *artist_name;
会場を正しくマップすることはできますが、アーティストをマップさせる方法がわかりません。オブジェクトマネージャーにイベントを終了するように指示するために必要なことはありますか?
これはiOS開発への私の最初の進出であるため、どんな助けでも大歓迎です。