ios - Facebook SDK share always returns sharerDidCancel -
this question has answer here:
i'm trying share post facebook sdk, sharerdidcancel called, either if share or cancel post. here code
- (void)sharefacebook { fbsdksharelinkcontent *content = [[fbsdksharelinkcontent alloc] init]; content.contenturl = [nsurl urlwithstring:@"http://www.google.com"]; [fbsdksharedialog showfromviewcontroller:view withcontent:content delegate:self]; } - (void)sharer:(id<fbsdksharing>)sharer didcompletewithresults :(nsdictionary*)results { nslog(@"fb: share results=%@\n",[results debugdescription]); } - (void)sharer:(id<fbsdksharing>)sharer didfailwitherror:(nserror *)error { nslog(@"fb: error=%@\n",[error debugdescription]); } - (void)sharerdidcancel:(id<fbsdksharing>)sharer { nslog(@"fb: canceled sharer=%@\n",[sharer debugdescription]); } this class implements fbsdksharingdelegate, in info.plist entered facebookappid , facebookdisplayname.
in appdelegate have method:
- (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation { return [fbappcall handleopenurl:url sourceapplication:sourceapplication]; } what i'm doing wrong? followed facebook sdk guide.
thanks
solved, error in appdelegate method:
here link solution http://jitu1990.blogspot.it/2015/05/share-with-facebook-from-ios-app.html
and here code
- (bool)application:(uiapplication *)application openurl:(nsurl* )url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation { return [[fbsdkapplicationdelegate sharedinstance] application:application openurl:url sourceapplication:sourceapplication annotation:annotation]; } - (void)applicationdidbecomeactive:(uiapplication *)application { [fbsdkappevents activateapp]; } - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { return [ [fbsdkapplicationdelegate sharedinstance] application :application didfinishlaunchingwithoptions:launchoptions] }
Comments
Post a Comment