2011-06-24 151 views
3

我陷入了奇怪的境地。我想從iPad應用程序上傳照片,該照片始終顯示在用戶的牆上。我已經嘗試使用「facebook.photo.upload」方法,但由於某種原因,它會在用戶的牆上顯示1張照片,並且所有其他上傳都會直接進入相冊,而不會出現在用戶的牆上。所以我想在用戶的牆上展示所有照片。在Facebook牆上上傳照片iPhone sdk

所以,另一種情況是我可以使用「stream.publish」,並附上我的照片附件參數。但在這種方法中,我需要我的UIImage的URL,這是我沒有的。即使我管理網址仍然我猜我的照片會顯示爲所有其他流顯示的縮略圖。我想要我的照片保存大小768X1004。

那麼,在iPhone SDK中實現這一點的最佳方法是什麼?我只想每次都在用戶的牆上上傳我的照片。我不介意它是否在專輯中。

在此先感謝幫助..

編輯:

我上傳的照片,以我自己的服務器完成這一點,並使用publish.stream張貼到用戶的牆。我沒有得到任何其他的方式。

+0

你使用過圖api – iProgrammer

回答

0

沒有得到任何解決方案。所以我通過將照片上傳到我自己的服務器並使用publish.stream將其發佈到用戶的牆上來實現此目的。我沒有得到任何其他的方式。

+0

你好,請問你告訴我如何做到這一點,你可以分享一些編碼。 – Vijay

+0

嗨Vijay,我上傳使用API​​和API的服務器上的實際圖像返回給我的照片的網址,我用「stream.publish」中的網址。這樣我就解決了我的問題。 – Deeps

1

嘗試Facebook的圖形API的這種方法,將張貼在Facebook上牆的照片

-(IBAction)postPictureButtonPressed:(id)sender { 

    NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:2]; 

    //create a UIImage (you could use the picture album or camera too) 

    NSData *imageData = UIImageJPEGRepresentation(imageView.image, 8.0); 
    UIImage *picture = [UIImage imageWithData:imageData]; 

    //create a FbGraphFile object insance and set the picture we wish to publish on it 
    FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture]; 

    //finally, set the FbGraphFileobject onto our variables dictionary.... 
    [variables setObject:graph_file forKey:@"file"]; 

    [variables setObject:@"this is a test message: postPictureButtonPressed" forKey:@"message"]; 

    //the fbGraph object is smart enough to recognize the binary image data inside the FbGraphFile 
    //object and treat that is such..... 
    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"117795728310/photos" withPostVars:variables]; 
    NSLog(@"postPictureButtonPressed: %@", fb_graph_response.htmlResponse); 

    NSLog(@"Now log into Facebook and look at your profile & photo albums..."); 

} 
+0

謝謝@IphoneDeveloper。我現在就試一試。會告訴你這件事的進展的。 – Deeps

+0

我只是給它一個嘗試和同樣的問題。它直接將照片上傳到相冊。如果我刪除了相冊並上傳新照片,它會在牆上顯示我。之後它不顯示。我需要每次爲iPad應用上傳的每張照片分開牆貼。這是通過圖形API的可能嗎?謝謝 – Deeps

+0

好吧,我還沒有在Facebook上創建任何專輯。可能是那個y我總是轉到牆貼吧 – iProgrammer

相關問題