2012-07-18 94 views
2

我有下面的代码来添加一个事件一切正常,并加载到Facebook没有问题唯一的问题是图像不上载也没有任何类型的在iOS的文档中帮助解决这个问题也许我正在寻找错误的地方?也许你已经度过了这一点,可以提供帮助。谢谢iphone - 如何使用Facebook IOS SDK创建事件时添加图像

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           [delegate facebook].accessToken, @"access_token", 
           @"Going To Eat!", @"name", 
           @"description of the event", @"description", 
           @"2012-08-20T17:00:00+0000", @"start_time", 
           @"2012-08-21T17:00:00+0000", @"end_time", 
           @"Carlsbad", @"city", 
           @"CA", @"state", 
           @"900 safe street", @"street", 
           @"OPEN", @"privacy", 
           @"https://.../img/faces/pizza-port-brewing-carlsbad.jpg", @"@file.jpg", 
           nil]; 

    [[delegate facebook] requestWithGraphPath:@"me/events" 
         andParams:params 
        andHttpMethod:@"POST" 
         andDelegate:self]; 

回答

2

好吧我想通了,如果你使用IOS的当前Facebook API,那么你可以传递一个UIImage对象到requestWithGraphPath:它会自动检测它并上传它到你的活动图标。如果它的图像链接然后使用NSURL创建一个UIImage。

UIImage *image = [[UIImage alloc][email protected]"test.png"];  
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           [delegate facebook].accessToken, @"access_token", 
           @"Going To Eat!", @"name", 
           @"description of the event", @"description", 
           @"2012-08-20T17:00:00+0000", @"start_time", 
           @"2012-08-21T17:00:00+0000", @"end_time", 
           @"Carlsbad", @"city", 
           @"CA", @"state", 
           @"900 safe street", @"street", 
           @"OPEN", @"privacy", 
           image, @"picture", 
           nil]; 

    [[delegate facebook] requestWithGraphPath:@"me/events" 
         andParams:params 
        andHttpMethod:@"POST" 
         andDelegate:self]; 
相关问题