私は自分のアプリでRestKitを使用しようとしていますが、gitサブモジュールとしてgithubのマスターを現在使用しています。すべてがインストールされて実行されています。私は私のレールのアプリからJSONデータを取得しようとすると、しかし、私はここで起こっているが、私は仮定すべきか365iOSでRestkitを使用しようとしました - Xcode
if ([_delegate respondsToSelector:@selector(request:didLoadResponse:)]) {
[_delegate request:self didLoadResponse:_response];
}
わからないライン、RKObjectLoader.mに、より具体的に、RestKitにBAD_EXC_ACCESSを取得していますRestkitの問題ですか?ここで
は私がしようとしているものです:
-(id) init {
self = [super init];
if (self) {
RKObjectMapping* patientMapping = [RKObjectMapping mappingForClass:[Patient class]];
[patientMapping mapKeyPath:@"id" toAttribute:@"identifier"];
[patientMapping mapKeyPath:@"first_name" toAttribute:@"first_name"];
[patientMapping mapKeyPath:@"middle_initial" toAttribute:@"middle_initial"];
[patientMapping mapKeyPath:@"last_name" toAttribute:@"last_name"];
[patientMapping mapKeyPath:@"email" toAttribute:@"email"];
[patientMapping mapKeyPath:@"password_hint_question" toAttribute:@"password_hint_question"];
[patientMapping mapKeyPath:@"password_hint_answer" toAttribute:@"password_hint_answer"];
[[RKObjectManager sharedManager].mappingProvider setMapping:patientMapping forKeyPath:@"patients"];
}
return self;
}
- (void)loadAll {
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/ios_patient.json" delegate:self];
}
だから、基本的に、私はこのクラスをインスタンス化し、LOADALLを呼び出します。私のios_patient.jsonが次のJSONコードを返しています:
{"patients": [{"id": 1, "first_name": "John", "last_name": "Appleseed", "email": "[email protected]"}]}
助けてくれれば幸いです。
NSZombieEnabledを有効にすると、クラッシュに関する詳細を知ることができます。また、malloc_historyをプロセスIDで使用することもできます。 –
Objective-C変数は、典型的には、それが価値があるかどうかについて、ラクダのケースで名前が付けられます。したがって、おそらく "first_name"変数が "NSString * firstName"として定義され、マッピングが "[patientMapping mapKeyPath:@" firstName "toAttribute:@" first_name "];" –
また、1.あなたはデリゲートを公開していませんか? 2. ARCを使用していますか? 3. RKObjectLoaderデリゲートメソッド(request:didLoadResponse :)を実装しましたか? –