Facebook的Hackbook集成在iOS5应用程序中

时间:2012-04-15 21:54:42

标签: ios facebook facebook-graph-api

我试图在支持iOS5 ARC的应用中使用Hackbook示例应用。我正在使用Facebook的示例Hackbook应用程序中的APIResultsViewController。我的应用程序启用了ARC,因此我确保我在Hackbook中使用的文件已将-fno-objc-arc添加为编译器标志。我现在遇到的错误是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];
}

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

这看起来很明显,但您的应用程序中是否包含SBJSON作为框架? http://stig.github.com/json-framework/