Iphone 创建Facebook事件然后向用户发送邀请的正确iOS语法是什么?
我有一个名为Iphone 创建Facebook事件然后向用户发送邀请的正确iOS语法是什么?,iphone,ios,facebook,facebook-graph-api,Iphone,Ios,Facebook,Facebook Graph Api,我有一个名为FBSession的会话类型。我知道会话已打开,但如何发送图形请求以创建事件,然后邀请用户参加该事件?我知道用户的Facebook ID,因为我设法从本地通讯簿属性中提取了他们 if (appDelegate.session.state == FBSessionStateCreatedTokenLoaded) { // even though we had a cached token, we need to login to make the session
FBSession
的会话类型。我知道会话已打开,但如何发送图形请求以创建事件,然后邀请用户参加该事件?我知道用户的Facebook ID,因为我设法从本地通讯簿属性中提取了他们
if (appDelegate.session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
switch (status) {
case FBSessionStateOpen:
{
/* What do I do here to create the event and invite IDs x, y and z where z, y and z are long long Facebook Ids */
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"venue name",@"name",
@"2012-01-13T17:00:00+0000",@"start_time",
@"2012-01-16T01:30:00+0000",@"end_time",@"location",@"location name ch",@"1234567890",@"id", nil];
FBRequest *facebook = [[FBRequest alloc] initWithSession:appDelegate.session graphPath:@"me/events" parameters:params HTTPMethod:@"POST"];
这是否正确?我需要运行哪些委托方法来检查它在appDelegate中是否正常工作?好。这看起来很酷
FBRequest *eventPostOK = [FBRequest requestWithGraphPath:@"me/permissions" parameters:Nil HTTPMethod:GET];
[eventPostOK startWithCompletionHandler: ^(FBRequestConnection *connection,
NSDictionary* result,
NSError *error) {
BOOL canDoIt = FALSE;
if (!error)
{
FBGraphObject *data = [result objectForKey:@"data"];
for(NSDictionary<FBGraphObject> *aKey in data) {
canDoIt = [[aKey objectForKey:@"create_event"] boolValue];
}
}
if (canDoIt) { ... DO STUFF .... }
];
FBRequest*eventPostOK=[fbRequestRequestWithGraphPath:@“me/permissions”参数:Nil HTTPMethod:GET];
[eventPostOK startWithCompletionHandler:^(FBRequestConnection*连接,
NSDictionary*结果,
N错误*错误){
BOOL-canDoIt=FALSE;
如果(!错误)
{
FBGraphObject*data=[result objectForKey:@“data”];
用于(NSDictionary*数据中的aKey){
canDoIt=[[aKey objectForKey:@“创建事件”]布尔值];
}
}
如果(canDoIt){…做点什么….}
];