iOS5 ARC 対応アプリで Hackbook サンプル アプリを使用しようとしています。Facebook のサンプル Hackbook アプリの APIResultsViewController を使用しています。私のアプリは ARC 対応なので、Hackbook から使用しているファイルに-fno-objc-arc
Compiler フラグが追加されていることを確認しました。私が今得ているエラーUse of undeclared identifer 'jsonWriter'; did you mean SBJSonWriter'?
はUnknown receiver 'jsonWriter'
Facebook API の src フォルダーから SBJSON を取得しました。アプリで Facebook API を動作させることができました。次に、Hackbook サンプルの機能とコードを使用したいと考えました。これらのエラーにコードを移動した後、ポップアップが表示されました。ご協力いただきありがとうございます
エラーが発生しているコードは次のとおりです
* Graph API: Check in a user to the location selected in the previous view.
*/
- (void)apiGraphUserCheckins:(NSUInteger)index {
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary *coordinates = [NSDictionary dictionaryWithObjectsAndKeys:
[[[myData objectAtIndex:index] objectForKey:@"location"] objectForKey:@"latitude"],@"latitude",
[[[myData objectAtIndex:index] objectForKey:@"location"] objectForKey:@"longitude"],@"longitude",
nil];
NSString *coordinatesStr = [jsonWriter stringWithObject:coordinates];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[[myData objectAtIndex:index] objectForKey:@"id"], @"place",
coordinatesStr, @"coordinates",
@"", @"message",
nil];
[[delegate facebook] requestWithGraphPath:@"me/checkins"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
}
助けてくれてありがとう