2013-01-24 56 views
0

Possible Duplicate:
How to post photos to facebook iphone fbconnectFacebook的錯誤得到圖像

我使用FB SDK,卻得到了錯誤,而在我看來,上傳的FB後的畫面從我的應用程序 沒有負載我已經和的UIImageView其中有我需要的圖像FB上張貼的視圖的代碼做負載

ImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 65, 65)]; 
ImageView.center = CGPointMake(42, 43); 
[View addSubview:ImageView]; 

,在我的FB後的方法,我這樣做

UIImage *image = [[UIImage alloc]init]; 
    image = ImageView.image; 

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:3]; 


    [params setObject:@"LINK_HERE" forKey:@"link"]; 


// due to this line below, i am getting an error : 
// "[UIImage length]: unrecognized selector sent to instance 0x170fa0e0" 
// and if use http link instead of image(UIImage) it works, but i want to use my image 
    [params setObject:image forKey:@"picture"];  

    [params setObject:@"NAME_HERE" forKey:@"name"]; 
    [params setObject:@"DEC_HERE" forKey:@"description"]; 

// Invoke the dialog 
     [self.facebook dialog:@"feed" andParams:params andDelegate:self]; 

如何守ld我在這段代碼中使用我的UIImage ...任何想法?

+0

http://yashesh87.wordpress.com/2012圖片/ 10/01/social-framework-integration-iphone-sdk-ios/easy上傳圖片的方法。 – jamil

+0

請在這裏查看我的答案。 http://stackoverflow.com/questions/6959961/how-to-post-photos-to-facebook-iphone-fbconnect/6960239#6960239 –

回答

-1
+0

閱讀這也... https://developers.facebook.com/docs/教程/ ios-sdk-tutorial/publish-open-graph-story /#step7 – Shivaay

+0

這並沒有提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 – Rikesh

+0

@Rikesh爲什麼你的nt給出答案then..for我的樣本項目是處理你的問題的最好辦法..以及我已經給出了他的描述的鏈接... – Shivaay

0

只能上傳基於URL的圖像在Facebook的內部產生的對話框method..Images應用程序或應用程序包內不能上傳..

要上傳那些你必須使用圖形API

示例代碼

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
    image, @"source", 
    @"caption desc", @"message",    
    nil]; 
    [facebook requestWithGraphPath:[NSString stringWithFormat:@"/me/photos?access_token=%@", self.facebook.accessToken] 
    andParams:params andHttpMethod:@"POST" andDelegate:self]; 
+0

出現錯誤錯誤:HTTP狀態碼:400 – iOSBee

0

您可以發佈圖片只是這樣

UIImage *imgSource = {insert your image here}; 
NSString *strMessage = @"Images Description"; 
NSMutableDictionary* photosParams = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            imgSource,@"source", 
            strMessage,@"message", 
            nil]; 

[self.facebook requestWithGraphPath:@"me/photos" 
           andParams:photosParams 
          andHttpMethod:@"POST" 
           andDelegate:self]; 
+0

出現錯誤錯誤:HTTP狀態碼:400 – iOSBee