Mysterious magnifying glass in Facebook Feed Dialog - ios

I installed Facebook iOS SDK via CocoaPods with Podfile
platform :ios, '6.0'
pod 'Facebook-iOS-SDK'
Screenshot is as follow:
A magnifying glass appears on the top right corner in Simulator, when I use the following code (in a button's IBAction) to attempt to share a message to Facebook (I follow the tutorial at Getting Started):
FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
params.link = [NSURL URLWithString:#"http://www.google.com"];
params.name = #"Google";
params.caption = #"Google is Great";
params.picture = [NSURL URLWithString:#"http://i.imgur.com/g3Qc1HN.png"];
params.description = #"Google is a good search engine";
if([FBDialogs canPresentShareDialogWithParams:params]) {
// Present share dialog (requires Facebook App v6.0+ installed)
[FBDialogs presentShareDialogWithLink:params.link
name:params.name
caption:params.caption
description:params.description
picture:params.picture
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(#"%#", [NSString stringWithFormat:#"Error publishing story: %#", error.description]);
} else {
NSLog(#"result %#", results);
}
}];
} else {
// Present feed dialog
NSMutableDictionary *params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Google", #"name",
#"Google is Great", #"caption",
#"Google is a good search engine", #"description",
#"http://www.google.com", #"link",
#"http://i.imgur.com/g3Qc1HN.png", #"picture",
nil];
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params1
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"%#",[NSString stringWithFormat:#"Error publishing story: %#", error.description]);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"post_id"]) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// User clicked the Share button
NSString *result = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
NSLog(#"result %#", result);
}
}
}
}];
}
And this at the end of the class, before #end:
// A function for parsing URL parameters returned by the Feed Dialog.
- (NSDictionary*)parseURLParams:(NSString *)query {
NSArray *pairs = [query componentsSeparatedByString:#"&"];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
for (NSString *pair in pairs) {
NSArray *kv = [pair componentsSeparatedByString:#"="];
NSString *val =
[kv[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
params[kv[0]] = val;
}
return params;
}
Feed dialog is used because the Simulator does not have Facebook App v6.0+
The magnifying glass blocks the Share button completely. How can I remove it?
Note: The version installed is v3.13.0 (at the moment of writing, the official latest version is 3.13.1).
Note: iOS used are 6.0, 7.0, 7.1.

This issue has been resolved by Facebook in server side. The magnifier has been removed.
No need to update Facebook SDK.

Related

In Facebook share I am unable to post name, linkDescription and picture on FBLinkShareParams on Facebook app installed condition

I want to post name, linkDescription and picture on FBLinkShareParams but I am unable able do that on Facebook app installed condition but It works fine in Facebook app not installed condition when it is done in FBWebDialogs. I was able to post params.link only in Facebook app installed condition.
I have used code as shown below:
#pragma mark - facebook share
//facebook share
- (void)shareLinkinFB{
/* Facebook app is installed*/
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:#"https://developers.facebook.com/docs/ios/share/"];
params.name= #"Dieheart";
params.picture= [NSURL URLWithString:Str_KoolkatPic];
params.linkDescription=#"A quick and better way to get anything delivered at your doorstep. ";
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
[FBDialogs presentShareDialogWithLink:params.link handler:^(FBAppCall *call, NSDictionary *results, NSError *error) { if(error) {
// An error occurred, we need to handle the error
NSLog(#"Error publishing story: %#", error.description);
} else {
// Success
NSLog(#"result %#", results);
}
}];
NSLog(#"Share login page Now");
} else {
/* Facebook app Not installed*/
NSLog(#"Share dialog");
NSString *urlString = [NSString stringWithFormat:#"%#/resources/images/login-logo.png",SERVER_ADDRESS];
NSString *Str_NameLabel;
NSString *Str_Description;
Str_NameLabel=#"testing for idelivery IOS application";
Str_Description=#"Share functionality in progress";
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
Str_NameLabel, #"name",
#"idelivery Town center", #"caption",
Str_Description, #"description",
#"https://www.facebook.com/edeliveryksa", #"link",
urlString, #"picture",
nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"post_id"]) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// User clicked the Share button
NSString *result = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
NSLog(#"result %#", result);
[self postSuccess]; // success vako condn ko lagi banako
}
}
}
}];
}}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BOOL urlWasHandled = [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
fallbackHandler:^(FBAppCall *call) {
NSLog(#"Unhandled deep link: %#", url);
// Here goes the code to handle the links
}];
return urlWasHandled;
}
// A function for parsing URL parameters returned by the Feed Dialog.
- (NSDictionary*)parseURLParams:(NSString *)query {
NSArray *pairs = [query componentsSeparatedByString:#"&"];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
for (NSString *pair in pairs) {
NSArray *kv = [pair componentsSeparatedByString:#"="];
NSString *val =
[kv[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
params[kv[0]] = val;
}
return params;
}
- (void)postSuccess{
NSLog(#" post success");
}
Hope any one would be able to help me
It looks like you're calling canPresentShareDialogWithParams: with the real params, but when it comes to actually presenting the dialog, you're calling it with a nil link, which is probably why nothing shows up.
You should call the presentShareDialogWithParams:clientState:handler: method with the params you created.
[FBDialogs presentShareDialogWithParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {...}];

Facebook share shows blank image on iOS but works fine on desktop

I am using AddThis from the following page: http://www.douglasstratton.com/Beaches/Amnesia/flypage.tpl.html
When sharing from the desktop, the image shares fine, but when sharing from iOS, the image is blank on the facebook wall.
Has anyone else had this issue?
You can share with this code.Only import #import <FacebookSDK/FacebookSDK.h>:-
// Put together the dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
APP_NAME, #"name",
self.strSerialName , #"caption",
modelObject.strChapterDescription, #"description",
#"", #"link",
modelObject.strChapterImage, #"picture",
nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"post_id"]) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// User clicked the Share button
NSString *result = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
NSLog(#"result %#", result);
}
}
}
}];

I want to share an image that is within the application bundle on facebook without url using FBWebDialogs?

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: #"The mechanic has done a fine job improving my vehicle…", #"name", #"Click below to download this awesome app for FREE and challenge me", #"description",iTunesLink, #"link", img, #"picture", nil];
//step 2
// Invoke the dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or publishing a story.
//nslog(#"Error publishing story.");
} else
{
if (result == FBWebDialogResultDialogNotCompleted)
{
// User clicked the "x" icon
//nslog(#"User canceled story publishing.");
}
else
{
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"post_id"])
{
// User clicked the Cancel button
//nslog(#"User canceled story publishing.");
} else
{
// User clicked the Share button
//NSString *msg = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
// Show the result in an alert
isSharedButtonTapped = YES;
self.btnFacebookShare.userInteractionEnabled = NO;
[[[UIAlertView alloc] initWithTitle:#"Success!" message:#"Successfully shared to Facebook" delegate:nil cancelButtonTitle:#"ok" otherButtonTitles:nil] show];
}
}
}
}];
If I'm providing the picture as "URL" its posting fine. Else its throwing error. I want to post an image that is within the application bundle. Can some on tell me where I'm coding wrong?
`NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Sharing Tutorial", #"name",
#"Build great social apps and get more installs.", #"caption",
#"Allow your users to share stories on Facebook from your app using the iOS SDK.", #"description",
#"https://developers.facebook.com/docs/ios/share/", #"link",
#"http://i.imgur.com/g3Qc1HN.png", #"picture",
nil];`
[FBDialogs presentShareDialogWithPhotoParams:params
clientState:nil
handler:^(FBAppCall *call,
NSDictionary *results,
NSError *error) {
if (error) {
} else {
//share successdialog
}
}];
You can use something like this
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];
FBPhotoParams *params = [[FBPhotoParams alloc] init];
// Note that params.photos can be an array of images. In this example
// we only use a single image, wrapped in an array.
params.photos = #[img];
[FBDialogs presentShareDialogWithPhotoParams:params
clientState:nil
handler:^(FBAppCall *call,
NSDictionary *results,
NSError *error) {
if (error) {
NSLog(#"Error: %#",
error.description);
} else {
NSLog(#"Success!");
}
}];
}
For more details you can check here.
However this will add the shared image to Photos which would not be the way you want it to be. It will create a folder with the name of the app and the image will be added under this.

FBWebDialogs does not show - no reaction

Please if any of you could help me with this Facebook SDK. I don't know what's going on, and the problem is that when button with facebook is clicked nothing shows up - FBWebDialog is dead but "Memory managment/consumption bar in Xcode when app is fired allocs additional memory (about 22 MB) after that action. I have followed official tutorial: https://developers.facebook.com/docs/ios/share and reainstalled facebook SDK, added things like AppID etc. Even that haven't helped me. What's wrong with that?
I'm using iphone simulator and ios 8 and Xcode 6.0. About 2 mounths ago everything worked fine. Pop-up window was showed in application until now.
Any help with this will be appreciated.
UPDATE:
MY CODE:
[FBLoginView class];
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:#"https://developers.facebook.com/docs/ios/share/"];
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present the share dialog
[FBDialogs presentShareDialogWithLink:params.link
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
// Success
NSLog(#"result %#", results);
}
}];
} else {
// Present the feed dialog
// Put together the dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Sharing Tutorial", #"name",
#"Build great social apps and get more installs.", #"caption",
#"Allow your users to share stories on Facebook from your app using the iOS SDK.", #"description",
#"https://developers.facebook.com/docs/ios/share/", #"link",
#"http://i.imgur.com/g3Qc1HN.png", #"picture",
nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:#"post_id"]) {
// User cancelled.
NSLog(#"User cancelled.");
} else {
// User clicked the Share button
NSString *result = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
NSLog(#"result %#", result);
}
}
}
}];
}
Standard code from Facebook site but still no reaction.

Unable to post an article with Facebook SDK on iOS with UIActivityViewController?

Building an iOS app for reading articles. I’m using Facebook SDK to share the article link and image on Facebook.
This is the process:
1.After clicking on bar button item on top right, UIActivityViewController gets opened on the bottom of the screen which gives option to share via fb, google , linked in etc.
2.On clicking the Facebook button in UIActivityVIewController, default screen opens for sharing but ideally fb SDK code should get executed.
The following "if condition” does not executed.
[AVC setCompletionHandler:^(NSString *activityType, BOOL completed)
{
if([activityType isEqualToString: UIActivityTypePostToFacebook]){
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
3.But when clicked on the cancel button of the default screen, “if condition" gets executed and app is able to share the article as expected.
Here is the code.
- (IBAction)ysshareAction:(id)sender {
NSURL *Imageurl = [NSURL URLWithString:_DetailModal1[2]];
NSData *data = [NSData dataWithContentsOfURL:Imageurl];
UIImage *image = [[UIImage alloc] initWithData:data];
NSURL *linkURL = [NSURL URLWithString:_DetailModal1[4]];//article url
NSMutableAttributedString *stringText = [[NSMutableAttributedString alloc] initWithString:_DetailModal1[0]];//_DetailModal1[0] contain article title////
[stringText addAttribute:NSLinkAttributeName value:linkURL range:NSMakeRange(0, stringText.length)];
NSArray *itemArrany = #[stringText,image,];//title is displayed but not as hyperlink.
UIActivityViewController *AVC = [[UIActivityViewController alloc] initWithActivityItems:itemArrany applicationActivities:nil];
AVC.excludedActivityTypes=#[];
[AVC setCompletionHandler:^(NSString *activityType, BOOL completed)
{
if([activityType isEqualToString: UIActivityTypePostToFacebook]){
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:#"https://www.youtube.com/watch?v=pa8lsBNG31c"];
// // If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present share dialog
[FBDialogs presentShareDialogWithLink:params.link
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
// Success
NSLog(#"result %#", results);
}
}];
// If the Facebook app is NOT installed and we can't present the share dialog
} else {
// FALLBACK: publish just a link using the Feed dialog
// Put together the dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"YourStory", #"name",
_DetailModal1[0], #"caption",
_DetailModal1[4], #"link",
_DetailModal1[2], #"picture",
nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(#"Error publishing story: %#", error.description);
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User canceled.
NSLog(#"User cancelled.");
} else {
// Handle the publish feed callback
// NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
// if (![urlParams valueForKey:#"post_id"]) {
// User canceled.
NSLog(#"User cancelled.");
// } else {
// User clicked the Share button
// NSString *result = [NSString stringWithFormat: #"Posted story, id: %#", [urlParams valueForKey:#"post_id"]];
//
}
}
}];
}
}
}];
[self presentViewController:AVC animated:YES completion:nil];
}
Any help is really appreciated.

Resources