2015-10-26 85 views
1

我想使用Open Graph API將照片分享給Facebook。我不確定如何分享照片,所以我開始使用代碼來發布照片。到目前爲止,我有以下代碼:如何分享到Facebook(iOS)

 // Create an object 
     NSDictionary *properties = @{ 
            @"og:type": @"myObject", 
            @"og:title": @"title", 
            @"og:description": @"description", 
            }; 
     FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties]; 


     // Create an action 
     FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init]; 
     action.actionType = @"og.likes"; 
     [action setObject:object forKey:@"myObject"]; 

     // Create the content 
     FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init]; 
     content.action = action; 
     content.previewPropertyName = @"myObject"; 


     [FBSDKShareDialog showFromViewController:self 
            withContent:content 
             delegate:nil]; 

我創建Facebook上「myObject的」一定製圖形對象,我試圖分享或類似這樣的公開在Facebook上。當這段代碼什麼也沒有顯示出來的時候,我會喜歡這方面的任何幫助。理想情況下,我想爲該對象添加一張照片,並且可以通過回調鏈接將其分享給我的網站(以及最終的應用)!

回答