[英]iphone : FBConnect Auto post to user wall
我想從我的iphone應用程序自動發布到用戶牆(沒有“發布”“跳過”對話框)。 我怎么能這樣做?
應在實現FBSessionDelegate
和FBRequestDelegate
的類中調用以下FBRequestDelegate
:
Facebook *_facebook = [[Facebook alloc] initWithAppId:kAppId];
NSArray *_permissions = [[NSArray arrayWithObjects:
@"read_stream", @"offline_access",nil] retain];
[_facebook authorize:_permissions delegate:self];
這就是對fb post的調用(應該在同一個類中使用):
NSString *message = @"This is the message I want to post";
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, @"message",
nil];
[_facebook requestWithMethodName:@"stream.publish"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
如果要在其他用戶的牆上發布消息,則應在params字典中包含“uid”參數。 請查閱http://developers.facebook.com/docs/reference/rest/stream.publish/
PS在iPhone Facebook連接SDK示例代碼中有所有必要的示例,所以請不要害怕調查一下 ;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.