Share 1 Facebook App ID with multiple iOS Apps using ACAccountStore - iphone

I have an iOS app configured to use Facebook login via iOS's ACACcountStore. I'm not using the Facebook SDK.
I'm creating another app (for the same company) and I'm trying to take advantage of the existing Facebook App that I've set up for the first iOS app.
I've read that you can add multiple bundle ids in the Facebook App's Settings. I've done this, but unfortunately, I get an ACErrorPermissionDenied error when trying to log in.
Using iOS's built in Facebook login, am I able to share one Facebook App Id with multiple iOS apps with different bundle ids?

Ahh, figured it out.
The good news is that this is definitely possible. Just go into your Facebook app's settings and add another bundle id.
Make sure that the bundle id you've set in your app is exactly the same as the one you add to facebook.
In my case, I was formatting part of my bundle id like so:
com.myApp.${MY_CUSTOM_BUNDLE_ID_SUFFIX:rfc1034identifier}.
MY_CUSTOM_BUNDLE_ID_SUFFIX is a User-Defined setting in my Target's Build Settings. I had it set to:
foo.bar
When processed with the rfc1034identifier, the . was converted to a - so it ended up being com.myApp.foo-bar, so the mismatch is what was causing login to fail.

Related

Launch Facebook messenger Share extension from my iOS app

I'm developing an iPhone app and I want to launch Facebook messenger share extension from when user wants to send a photo to one of his friends.
How can this be done?
I was able to use FBdialog, but this takes the user our of the app and I don't like this option.
Thanks.
Your application must have received permissions by the user via the access token (publish_actions). Otherwise, you'll get into the fast-app-switch, which displays a separate page.
Once a user gives your app appropriate permissions, then your FB action can be seamless, without switching across.
In a nutshell, you should implement a "login" method that users "login" to your application using Facebook (more specifically - gives your app permissions to access certain parts of their FB profile), and then you should be able to use native SDK capabilities.
If you use UIActivityViewController as long as the shared objects (NSString, UIImage, etc) are compatible it should show up automatically on the share list sheet in iOS 8.
The user may have to enable it by pressing "More"

Facebook not allow to use account for ios apps

I have created a IOS app.this app is using login with Facebook its working okay but I have created same copy for code for my new app.I have changed name of the app and also Bundle Identifier and all other setting to compile as a new app.Its not listed under the IOS setting->facebook even Facebook login not working for new app created by same code.
Did you create the facebook app on Facebook dev ? You need to do that to get the facebook id to set in your .plist.
See Doc for more information

ios bundle id questions to start first facebook app

I've been trying to learn how to do my first facebook app. The directions at developers.facebook.com/apps/407656052586647/summary?web_hosting=0 asks for my ios bundle id.
I've looked on this website, and Bundle ID Suffix? What is it?, discusses it (assuming bundle id and bundle suffix id are the same), and it sounds like it's linked to the apple id. I'm just developing the app and don't have an apple id yet, assuming it's tied to distributing the app to itunes. Which comes first, the chicken or the egg? I haven't even written the app so how could I have an id for itunes? I saw this Bundle ID for App submission iOS, but I'm absolutely not ready to submit it to itunes.
I read somewhere on this site that I need to go to xcode ->resource->settings bundle to create a bundle for the project. Would I put every file for the project in the bundle in the finder window?
Also, the hackbook example, referred to in http://thinkdiff.net/facebook/how-to-develop-facebook-application-for-iphone/comment-page-1/#comment-293743, in step 3 (it's calling it demoApp, but the name I found is Hackbook, but it's working as an example so far anyway) refers to setting the kAppId. Their link to create an app id doesn't work. Would it be the same as what I'm doing at developers.facebook.com in the first paragraph of this question above? Would this app id be what I get from a successful submision at developers.facebook.com/apps/407656052586647/summary?save=1 ? I see they are listing an app id and app secret code there, but it's not working because I don't have an ios bundle id? Would the bundle id be my bundle name (drag contents of xcode project in)?
Thanks for any help you can provide...
Mich
There's no need to worry about submitting the app to iTunes yet.
In order to get your app working with Facebook, you'll need to access https://developers.facebook.com/apps.
From there, click "Create New App"
Simply specify App Name. App Namespace is not needed at this point and is optional.
Click Continue and you're new Facebook app will have been created. From there, you will be provided your App Id. Use your Facebook App Id in this line of code:
[[Facebook alloc] initWithAppId:#"<APP ID GOES HERE>" andDelegate:self];
Your links dont work, but I think that they refer to the bundle ID on developer.facebook.com where you will need to create an App ID and use it in your iOS app. Did you do that already? Thats definitely a prerequisite before you even deal with itunes.
This seems to be a popular question so I thought I'd add some more info on what I decided to do. After I created the app id at the facebook developers link, I wound up using ShareKit2.0 to get the newer version of ios to work. The Hackbook/Demo example at the link above is in the older ios version so I couldn't get it to work with ios5. It was helpful to use the Hackbook to figure out what I needed for permissions, but that's it. I wound up following the SharKit2.0 directions (not at their website, go to the git version that the community is currently updating). Static Facebook sdk has no .m files in it
The directions that are at the link were helpful to create and start my first facebook app including app id. I never wound up doing anything with Bundle.

Facebook Authorize not working on free version of app

I have a free and paid version of my app on itunes but as the free version has in app purchase I cant use the same bundle id across the two apps and therefore the only way I can see of adding facebook to the free app is having a second facebook app registered?
I have done this but for some reason when calling [facebook authorize: permissions] my app boots up the facebook app but returns straight away to my app, not getting in to any of the handleOpenUrl functions or even asking the user for permissions. The code is identical line by line to the paid version of my app with the only difference being the appID that is used. Any ideas what would cause this? Facebook did work on both apps until the recent updates.
After further playing around with this code I have found it works if I tell it to not use the FB App and to instead use safari authorisation. Still failing to see why I can use the app on one app but not another :s
Log in to developers.facebook.com and check your iOS bundle ID for your free app carefully. Make sure the bundle ID you tell Facebook is exactly what your app thinks it is. If it's not identical, the new Facebook app will not allow your app to authenticate.
You can have multiple iOS apps use the same Facebook app. Check this link..
https://developers.facebook.com/docs/mobile/ios/build/#multipleapps
There are three steps:
Add the additional bundle id in your apps "iOS Bundle ID" file in your faceBook app settings.
Then in your iOS apps, use the 'urlSchemeSuffix' option in the 'initWithAppId' method.
Modify the URL Schemes property in the info.plist.
The link explains it in detail. No need to register a 2nd app with Facebook.
Hope this helps.

Facebook iOS SDK - GitHub - Cannot switch back calling app

According to the GitHub,
If the app is running in a version of iOS that supports multitasking, and if the device has the Facebook app of version 3.2.3 or greater installed, the SDK attempts to open the authorization dialog withing the Facebook app. After the user grants or declines the authorization, the Facebook app redirects back to the calling app, passing the authorization token, expiration, and any other parameters the Facebook OAuth server may return.*
My application calls authorize: permissions: delegate: and my application is suspended and Facebook application is launched and authorization is asked. After the user allow or disallow, the Facebook applications stayed on NEWS FEED (not returning to my application).
Questions:
Is it possible to authorize or logged-in and returning to my application?
How can my application check whether the authorization and logged-in is done and no need to re-do again?
I found this.
During single sign-on, the Facebook application isn't redirecting back to my application after a user authorizes it. What's wrong?
Make sure you've edited your application's .plist file properly, so that your applicaition binds to the fb[appId]:// URL scheme (where "[appId]" is your Facebook application ID).
My Application can be switched :)
Thanks all
After struggling for long time finally got a solution for this problem, I dont its correct but its working like charm for my App:
go to developer.facebook.com
Select your app from list (App which app is your are using in URL scheme)
If your app is selected as native app then it will ask for bundle identifiers
provide him bundle identifier by using which you are building your app
if your using wildcard bundle identifier then provide like com.product.abc otherwise provide full bundle identifier.