Sharekit opens up Safari to get authentication from the user which is fine (not sure if it should open up Safari or in it's own window). A page then appears saying you have authenticated app.x click ok to continue, once the continue button is tapped it tries to redirect to www.facebook.com/permissions.request but then show an error of:
'Cannot Open Page, Safari cannot open this page because the address is invalid.'
Any ideas what might be going on here, I'm presuming it should be redirecting to my app?!
Here's my solution to this problem (I am assuming you are using ShareKit 2.0):
I configured ShareKit following the guide they provide ShareKit Configuration Guide. In other words I subclassed the DefaultSHKConfigurator class and added all the necessary configuration there.
In my app delegate I linked the configuration class with ShareKit like this:
DefaultSHKConfigurator *configurator = [[MYSHKConfigurator alloc] init];
[SHKConfiguration sharedInstanceWithConfigurator:configurator];
And removed the configuration info from SHKConfig.h. I don't know why but this worked.
note: you could also get away by not subclassing and entering the configuration info directly inside the DefaultSHKConfigurator.m if you are not interested in updating ShareKit;
If you wish the Facebook screen to load inside the app and not in safari you can get inside the Facebook.m file and change the safariAuth: from YES to NO:
[self authorizeWithFBAppAuth:YES safariAuth:NO];
Same issue here, when I stop after complete step 5 in https://github.com/ShareKit/ShareKit/wiki/Installing-sharekit.
Always got "safari cannot open then page because the address is invalid",
Finally, issue solved by complete all steps(1 to 7)
Have not changed the statement [self authorizeWithFBAppAuth:YES safariAuth:YES];
Related
In my app I'm using the following code that allows to share an image with a text:
- (IBAction)sharePressed:(id)sender {
UIImage *postingImage = [UIImage imageWithContentsOfFile:self.filepath];
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:#[#"Lorem ipsum", postingImage] applicationActivities:nil;
[self presentViewController:activityViewController animated:YES completion:nil];
}
Posting the image to Facebook works fine and it appears on my FB wall, however in my console I get the following message:
plugin com.apple.share.Facebook.post invalidated
I've tested it on a couple of devices, as far as I could see it only happens on my iPhone 6 with iOS 8.1 installed.
Anyone knows what that message means and how to prevent it from showing?
Here is the correct answer ios plugin com.apple.share.Facebook.post do not show provided text. It's a bummer.
I'm afraid to tell you, you cannot post text to Facebook programatically. It's a new Facebook prohibition that forbids "pre-filled" Facebook sharing. That is why newer versions of iOS do not show your text, even tough it's correctly provided (and works on Twitter and in other sharing options).
For more info please refer to https://developers.facebook.com/docs/apps/review/prefill
This is a terrible error message by Apple. Go to settings and check your facebook/twitter accounts. You will notice they have no password set (perhaps this happens after updating to 8.1). Just update the account info and the message will be gone and your post/tweet will work.
In my case, this is related to the fact that the Facebook app replaces the iOS system level Facebook share extension with a custom one. Case is triggered as follows:
Load an app and share to Facebook (Note: Facebook app is currently
installed)
Exit app
Delete the Facebook app from device
Open app again (still active in memory) and share to Facebook ...
fail! The app is looking for a share extension that was
uninstalled along with the Facebook app
Kill and restart the app, share to Facebook. Voila! The app has loaded the default iOS Facebook share extension and it works again.
Head scratcher as to why Apple let Facebook take this approach as opposed to either forcing them to replace the default Facebook share extension or just not allowing them to inject their own, only if their app is installed.
It also happen when u try to set an URL using addURL: method for SLServiceTypeTwitter in your SLComposeViewController. Deleting it fix the issue.
Facebook has updated their policy. It doesn't work with this anymore. you need to integrate Facebook sdk to do so. here is the relevant references for those who want to share image or post from your app to Facebook
https://developers.facebook.com/docs/sharing/opengraph/ios#sharedialog
I faced the same issue. I was using activity controller and SLComposeViewController, and in both cases got the same error, even if i don't set any text/url etc for fb programatically. So according to me, in my case, it was not the issue of new facebook policy as mentioned in comment above.
To avoid any inconvenience in future, i fixed it by using facebook share SDK (not using SLComposeViewController or activityViewController now). FBSdk is integrated in my iOS project and the code, i used for sharing purpose is as:
#IBAction func shareOnFaceBook(sender: AnyObject) {
var content = FBSDKShareLinkContent()
content.contentURL = urlToShare() //method returning the url
content.contentDescription = textToShare() //method returning text(string) to share
var dialog = FBSDKShareDialog()
dialog.mode = FBSDKShareDialogMode.Automatic
dialog.shareContent = content
dialog.delegate = self
dialog.fromViewController = self
dialog.show()
}
It'll open fb application (if installed), Otherwise will open Safari (fb web application).Hope that it'll help you
Best,
I've been following Facebook code sample "FBShareSample" to create a share dialog,
The example handles the fallback for user without FB App installed.
Everything is working well with FB App but when I get to the fallback the UI in my app look different from the one in FBDemo (navigation bar, buttons etc.)
In addition the friends button is not active.
Am I missing some kind of configuration in my iOS client? Is it somehting that need to be configured on my App page on FB?
I've used Charles to analyse the request and response and the only difference between FB sample code and my code was the userAgent string.
The problem was resolved by removing from the UserAgent parameter the string: " webView", for some reason this specific string caused FB to return a different layout/CSS page when this parameter was present.
I know there are a lot of topics on this issue, but I just can't figure out what is wrong.
I want to implement sharekit for Facebook and Twitter, so I followed the install instructions on the github:
Appid is set, got my entry in the cfurlschemes thingy, etc.
I authorize my app:
- (void)authorizeFacebook {
[self.facebook authorize];
}
(self.facebook is a strong member of a share controller singleton).
To share:
- (void)shareFacebook:(SHKItem*)toShare {
[SHKFacebook shareItem:toShare];
}
I also tried:
- (void)shareFacebook:(SHKItem*)toShare {
[self.facebook setItem:toShare];
[self.facebook share];
}
The same constructions are made for twitter.
I can authorize my apps without issue, so my configuration should be fine. When I authorize my app before i call the shareFacebook function, it is authorized but nothing happens with the sharing.
When I don't auhorize before calling shareFacebook (so sharekit detects it is not authorizes and opens authorization first) the'sharekitSendDidFinish' notification is fired but nothing appears on Facebook.
The same goes for Twitter, authorization works but no tweets appear. The SHKItem i'm trying to share is not nil and is filled with the correct stuff I need to share.
*Edit
I'm trying to share an SHKItem with:
Title
Text
Image
I also tried to send an SHKItem with just text, but that didn't work either.
Reinstalling ShareKit did nothing.
Failed with error is not being fired
Senddidfinish is being fired (but only if you authorize via the share function) and has no 'last error'
Solved it, I forgot to set the sharetype... stupid that it doesnt give an error for this :S
My app uses a custom URL scheme so i send a link to my users in an email which when clicked, launches my app installed on their devices. This was working seamlessly till iOS 6 came into picture.
Now when the users click on the link or even type the address manually in the safari they get an error saying "Safari cannot open the page because it is a local file."
Wondering if anyone else encountered the same or if someone has any pointers in this regard !!
Any help much appreciated...
Update: it works if I only give my app's custom url without any parameters.. e.g. if I do "reader-app://" it launches my app but if i do "reader-app://doc=xyz" it doesn't !
try: reader-app://?doc=xyz (add a question mark after //) this way you'll specify a query string. It works for me, but it presents an alertdialog asking the user if she wants to open the url with my application
Try to remove the - sign from reader-app://.
My URL was not working until I removed underscore sings from URL.
Ex:
my_app:// is not working.
myapp:// is working.
That is just a guess.
I've been trying to make phonegap-plugin-facebook-connect cordova plugin Simple example work, and i've experienced a weired problem.
First I had the Facebook iOS application on my iphone:
On my test application based on the Simple example, when i click the Login button, it just switches to the Facebook iOS app, and switches back to my application.
Clicking the "Me" button gives me an error "an active access token must be used to query information about the current user" which means the login was not successful
Then I removed the Facebook iOS application from my iPhone:
It worked. It opens Safari with Facebook authorisation page, when i click OK it switches back to my application and the auth.login events are successfully fired.
Is this a known issue ? Is there a way to fix it ?
Thank you
I found a workaround:
in Facebook.m
- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;
[self authorizeWithFBAppAuth: NO safariAuth:YES]; //Use Safari Auth instead of FB App
}
With this workaround Facebook iOS authorization will not be used, wheter installed or not.
Github issue#25