Parse FacebookUtils for iOS 9 failing with -canOpenURL error - ios

I've been using Appcelerator for mobile apps for some time, but due to a problem with the Facebook SDK, I've been looking at swift in order to move the apps to native, and have more control.
All the apps currently use Parse for the back end, and have had Facebook sign in through the Appcelerator Facebook module.
However, all the iOS versions built with Appcelerator now (since iOS9) fail to login with the following error:
-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
I have now set up two blank swift projects, one to use the Parse SDK, and one to use the Facebook SDK. Both projects run as intended, saving objects to Parse, and signing in with Facebook respectively.
The Facebook project signs in and retrieves the users email and public_profile fine, and although I still get the above mentioned error it doesn't affect the sign in process, or the data retrieval.
However, I have now tried to amalgamate the two and use the Parse FacebookUtils framework, but I am having the same problem I was having with the Appcelerator apps. I'm getting the error, and then nothing.
This appears to me as though the above error is causing the FacebookUtils framework to fail silently, as with the Appcelerator Facebook module.
So, I guess my initial question is:
Has anyone had any luck using the Parse FacebookUtils framework with iOS9?
If others have been successful, then I can investigate further, I'd just rather not spend hours going round in circles trying to implement something that just isn't possible.
Xcode: 7.1.1
ParseFacebookUtilsV4
Facebook LoginKit: V4.8.0
Here is my swift login code:
let readPermissions = ["public_profile","email","user_friends"]
PFFacebookUtils.logInInBackgroundWithReadPermissions(readPermissions, block: {
(user: PFUser?, error: NSError?) -> Void in
NSLog("Signing in")
if let user = user {
if user.isNew {
NSLog("User signed up through facebook")
} else {
NSLog("User logged in through Facebook")
}
} else {
NSLog("user cancelled login")
}
})
The closure is never called, and the logging of "Signing In" is never output.
If it helps I can post the blank project on Github.
Thanks
Paul

I'm not that familiar with the Swift side of things, but my guess is that this is a case of needing to Whitelist the Facebook apps within your info.plist
Read the whitelist section here for information: https://developers.facebook.com/docs/ios/ios9

Related

swift - Sign in With Apple "Sign Up not completed" error

Made all the setup for sign in with apple, but when pressing on continue and passing Face ID check I am getting "Sign Up not completed" error. However, no error is thrown to the delegate.
Then I tried to create a test project with my friend's Paid developer account and everything was fine, no errors. I haven't connected to the API, just trying to print Email and Fullname.
May be something is wrong with my company's Developer account?
I had the same issue. I did followings and it was working fine.
Go to developer apple and choose app's bundle id
Remove Sign In With Apple and save
Again go to your app's bundle id and add Sign In With Apple and save.
Hope this works!
I had created Auth Key with Apple Sign selected in which is never used. When I remove the unused Auth Key it worked.
I recently encountered this error and the root problem turned out to be some back-end data problem with my Apple account.
I ultimately had to raise an Apple Technical Support Request, generate some debug information for them, and then they ultimately fixed their back-end data for my account. The overall process took just under three weeks.
For me the reason was , I was using my bundle id in the place where Apple services ID should be entered in cognito user pool.
As suggested on this SO thread, this is sometimes an issue one Apple's end. I have tested with Apple's own project from the documentation and ran into the same issue.
I reached out to Apple DTS support and they replied the following:
The underlying issue was unexpected. We have confirmed the issue was
caused by an internal data feed sync operation and was resolved today.
So in my case, the issue went away after 2 days without any changes.
Sometimes, it just takes 2 days on Apple's side to process everything.
Spare yourself the hassle and just wait it out. If you have followed their documentation you did everything right:
https://help.apple.com/xcode/mac/11.0/#/dev50571b902
Just go to your project's signing capabilities, click + and add Sign in with Apple:
Add the SignInWithApple Button:
import AuthenticationServices
...
SignInWithAppleButton(.signUp) { request in
request.requestedScopes = [.fullName, .email]
} onCompletion: { result in
switch result {
case .success(let authResults):
handleSuccess(authorization: authResults)
case .failure(let error):
logger.error("SIWA login failure: \(error)")
}
}
.signInWithAppleButtonStyle(.white)

Does Facebook Deferred Deep Linking on iOS work, and how to test it before publishing the app on Store?

I have a problem with Facebook Deferred Deep Linking on iOS. DEEP LINKING WORKS, BUT DEFERRED DEEP LINKING DOESN'T WORK. I have read a lot about this problem and still cannot find the solution.
I have set up deep linking and it works. When I also try to test deep linking on App Ads Helper and click on "Test deep link", enter deep link and click on "Send notification", I receive a notification on Facebook which opens my app, and this deep linking works. But, when I click "Select Deferred", I don't receive anything. I try to delete app and reinstall it, but [FBSDKAppLinkUtility fetchDeferredAppLink:...]; method doesn't get any deferred deep link after new install.
[FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) {
if (error) {
NSLog(#"Received error while fetching deferred app link %#", error);
}
if (url) {
[[UIApplication sharedApplication] openURL:url options:#{} completionHandler:^(BOOL success) {
}];
}
}];
In this example, url is always nil.
Note: I still don't have app on Store, so I entered a Apple Id of another application. Even if I had my own app on Store, how could I test deferred deep linking without publishing app on Store?
Also, I have read on Facebook documentation that:
Beginning with iOS 10, iOS doesn't support deferred deep linking, so you can't open content other than the starting screen once people have installed the app. (Source)
So, I am not sure if this is even possible.
Also, I have read another articles on Stackoverflow, but there are not answer that I am looking for, i.e. they look incomplete, or I just don;t see the answer between the lines:
How to use facebook deferred deep linking feature for new installs
and to test the same before publishing iOS App to appStore? -> Answers to this question aren't what I am looking for:
If you want to verify deferred links then check 'Send Deferred' in the dialog.
So, after doing this you need to uninstall the app(if already present) and then install again from the app store. The device in which you will be testing this should have facebook app installed and logged in with the account from which you had sent the "deferred deep link request" from app-ads helper.
Now when you open your app, you should bee able to see your deferred deep link functionality working.
This doesn't work, so that's why I am asking this question.
Also, I have found that I could use Tune SDK for deferred deep linking:
...this is not a problem with the iOS 10 operating system itself. Deferred deep linking works just fine for iOS 10 using the TUNE SDK. (Source)
Also, I have found that I could use Branch.io for deferred deep linking:
With Branch, you get all the basic routing of a Universal Link plus the deferred deep linking and install attribution for the new user acquisition flow. (Source)
I haven't tried Tune and Branch.io. I would like to use Facebook ads and perform deferred deep linking without third party solutions. Is it possible with Facebook, and how to test deferred deep linking for Facebook on iOS?
It worked for us after resetting advertising identifier. Maybe internally they are preventing attribution in the same app twice if it is the same advertising identifier. So go to settings and reset your advertising identifier before testing. Also make sure the phone has not opted out of tracking.
For me, the answer was in my iPhone settings. I had "Limit Ad Tracking" enabled. I don't have much documentation proof that this was causing the issue but after changing it, it is now working. It's worth testing it yourself.
On your iPhone go to: Settings -> Privacy -> Advertising (at the bottom of the page)
There you should ensure that "Limit Ad Tracking" is set to off.
You should then recieve a URL if you have your app URL Scheme correctly set (see here if not) code which for swift should look like this:
AppLinkUtility.fetchDeferredAppLink { [weak self] (url, error) in
guard let self = self else {return}
if (url != nil) {
} else if error != nil {
print("Error: \(error!.localizedDescription)")
}
}
To test the deferred links, you can go here.
A bit late, but per your comment on the previous answer: Once you receive the message:
The link has been queued and is pending you doing a first app launch on your device. This means you need to delete the app, then re-install and open your app. Please first verify your app can handle deferred deep linking by checking the iOS and Android setup information located above.
Delete the application from your device
Open Facebook notifications from your device, you should have a deeplink notification
Selecting the deeplink notification should direct you to the appropriate app store to install the application again
Once installed, launching the application should trigger the intended 'Deferred' deep link
For deferred deep link to work, you also need to be logged in on the Facebook app. The ads helper tool: https://developers.facebook.com/tools/app-ads-helper/ knows your logged in user id on facebook.com. Facebook then uses this info to match your id, the app and the device information and returns an appLink back to your app if so.
Unfortunately, that's not possible on simulator given the limitation to install other apps like Facebook.
Your only option is to use a real device and build your XCode project on it. Make sure you have Facebook installed and that you are logged in with the same user as on your desktop web browser.
If you are running Facebook ads with Deep linking enabled, you can test deferred deep linking setup here: https://developers.facebook.com/tools/app-ads-helper/
You will need to select your app, then you should be able to access the deep-link tester at the bottom of the page (in which you can also select deferred)
Additional info:
So you need to deploy the app to the store? – locoboy Aug 7 '15 at 16:38
For testing Deep Link or Deferred Deep Link as they said before me:
deploy to store not required, use FB Ads panel for testing
check just in case statistic for app installs (not equal zero) - may be AppEvents (automatically logged) doesn't work correct (keep in mind, in the calculation of statistics, there may also be a delay)
Install Facebook application for your device, auth in using the same profile that you use to send notifications (run FB app in background)
Select both 'Send Notification' and 'Send Deferred' check marks (or check only 'Send Deferred' - results will available after manual app reinstall, and don't forgot trigger FBSDKAppEvents activateApp)
Example after successful sending
The main objective - after sending the message you will see it in Facebook! app notifications, with logo + text "Tap to launch your deep link"
Tap on notification

iOS Facebook Account kit - Persist user token when app is opened 2nd time after successful login

My doubt is after successful login using Facebook account kit for the first time, I am reopening the app for the 2nd time. When I open how can I detect and use the existing user Access Token?
I tried by fetching Accountkit.currentAccessToken in appdelegate as a condition to show login page or welcome page. But currentAccessToken returns me null.
I have also enabled "Enable Client Access Token Flow" in app settings.
Kindly help to understand if my approach is right.
self.accountKit = AKFAccountKit (responseType: AKFResponseType.accessToken)
if(self.accountKit.currentAccessToken != nil)
{
//SHOW WELCOME PAGE
}else{
//SHOW LOGIN PAGE
}
I am facing the same issue in Android (not in iOS) but I think the problem is same, since in the document says it so.
this is my code for configuring the login using Email (kotlin, use let to change the val).
val configurationBuilder = AccountKitConfiguration.AccountKitConfigurationBuilder(
LoginType.EMAIL,
AccountKitActivity.ResponseType.CODE)
notice that the response type is AccountKitActivity.ResponseType.CODE
In the document says:
If you began the login session with AccountKitActivity.ResponseType.TOKEN, a logout option is available to remove the stored AccessToken from the device.
So the problem is on the Response type that I use, need to be changed into AccountKitActivity.ResponseType.TOKEN in order to make the token stored on devices.
I have seen some issues with Xcode8 / iOS 10 Simulators and keychain save/retrieval. See https://forums.developer.apple.com/thread/60617
AccountKit stores the accessToken securely in the keychain but there is an intermittent bug on Xcode8 / iOS 10 Simulators that makes read/write from keychain fail.
Can you test if this is also happening on a Device?
Apparently the problem goes away if you add the Shared Keychain Entitlement to your App, but this is still a bug on Apple.

"There are no Facebook accounts configured" error message on iOS when use IS logged in via Settings - app built with Corona SDK

One of our users is getting the following error when they try to post from the native popup:
No Facebook account.
There are no Facebook accounts configured. You can add or create a Facebook account in Settings.
However they assure me that they are signed into Facebook via Settings, and they are still able to post from one of our other apps. All other test users can post directly without any issues, and afaik it worked in the past in this app for the user who is currently experiencing problems.
It seems like it's most likely an OS issue rather than an issue in my code, I simply request that the native popup be shown and pass an image and some text through (these are still being pushed to the native popup correctly):
if native.canShowPopup( "social", "facebook" ) and system.getInfo("platformName") ~= "Android" then
local function socialFBListener(e)
if e.action == "sent" then
print("FB post sent successfully")
end
end
local options = {
service = "facebook",
message = "Here is some testing text",
listener = socialFBListener,
image = {
{ filename = "testImage.jpg", baseDir = system.DocumentsDirectory },
},
url = "http://quixtix.co",
}
native.showPopup( "social", options )
end
I can't find any reference to anyone receiving this error when they are signed in, all links I could find simply tell you how to sign in.
Error was due to a fault on the user's device. After updating iOS and restarting the device the problem went away.
I have the same problem. But its due to I was forgot to set my app as
'Public'
it can be done by,
Goto https://developers.facebook.com -> App Review
Set Make 'appName' public? to YES.
For anyone who are struggling with this issue at the moment, the solutions are worked out like this:
Delete the Facebook account at iOS "Settings".
Try to connect with your Facebook account at your app again.
Get success
Add the Facebook account back to iOS "Settings" again if you'd like.
Cheers.

iOS phonegap-plugin-facebook-connect vs Facebook iOS Application

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

Resources