맞춤 버튼을 클릭 할 때 사진을 공유하고 싶지만 링크 및 메시지를 공유 할 수 있지만 사진 공유는 할 수 없습니다.Objective C에서 Facebook에 사진을 공유하는 방법은 무엇입니까?
저는 최신 Facebook SDK 프레임 워크 (4.15.1)를 사용하고 있습니다.
이것은 내 버튼 클릭 내 코드입니다.
- (IBAction)btnsharecustom:(id)sender {
//Get aws s3 Image.
NSString* strS3ImageURL = @"https://TEST_IMAGE_URL/1473497380077.jpg";
//Convert to URL.
NSURL* url1 = [NSURL URLWithString:strS3ImageURL];
//Convert it into data.
NSData* data = [NSData dataWithContentsOfURL:url1];
//Convert it to image.
UIImage* image = [UIImage imageWithData:data];
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc]init];
photo.image = image;
photo.caption = @"Test Caption";
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
}
이 코드를 앱 대리인에 포함 시켰습니다. 나는 내 사용자 지정 버튼 페이스 북 앱이나 사파리 브라우저를 실행하지 않습니다에 클릭, 그래서 누군가가 여기에 놓치고 무엇을 말해 줄 수있을 때
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return YES;
}
//FaceBook URLs.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
];
// Add any custom logic here.
return handled;
}
또한의 Info.plist
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb15771408xxx409xx</string>
</array>
</dict>
<key>FacebookAppID</key>
<string>15771408xxx409xx</string>
<key>FacebookDisplayName</key>
<string>Cedar iOS</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbapi20160328</string>
<string>fbauth</string>
<string>fb-messenger-api20140430</string>
</array>
이 코드를 포함?
FBSDKSharePhotoContent은 그래서 당신은 응용 프로그램이 있는지 확인하고. –
@SanketBhavsar 그래, 내가 설치 한 FB 앱에 로그인하고 또한 로그인 ... FB 응용 프로그램에서 작동합니다. – Ganesh
응용 프로그램을 통해 페이스 북에 로그인했는지 확인하고 페이스 북에서 컨텐츠를 공유 할 수있는 권한을 부여하십시오. 코드를 원한다면 코드를 게시 할 것입니다. –