【发布时间】:2023-03-15 05:32:01
【问题描述】:
我试图从我的 iPhone 应用程序发布到 Facebook,但它不起作用。
这就是我正在做的:
if (![_facebook isSessionValid])
{
NSArray *permissions = [NSArray arrayWithObjects:
@"read_stream", @"publish_stream", @"offline_access",nil];
[facebook authorize:permissions delegate:self];
}
NSMutableDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:
@"User Prompt Message", @"user_message_prompt",
@"http://www.mywebsite.com/", @"link",
@"http://mywebsite.com/wp-content/uploads/2011/05/iTunesArtwork.png", @"picture",
nil];
[facebook requestWithGraphPath:@"me/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
我也试过了
[self.facebook 对话:@"feed" andParams:params andDelegate:self];
但在任何一种情况下,我的应用都会在
中终止
- (FBRequest*)openUrl:(NSString *)url 参数:(NSMutableDictionary *)参数 httpMethod:(NSString *)httpMethod 委托:(id)委托
或在
- (void)dialog:(NSString *)action andParams:(NSMutableDictionary *)params andDelegate:(id )委托
取决于我使用此日志调用的方法:
* 由于未捕获的异常而终止应用程序 'NSInternalInconsistencyException',原因:'-[__NSCFDictionary setObject:forKey:]: 变异方法发送到不可变对象'
这对我来说没有意义,因为所使用的字典是可变的。
我做错了吗?任何帮助将不胜感激。
【问题讨论】:
标签: iphone facebook facebook-graph-api nsmutabledictionary