Hi I am building an iOS app using swift 4.2 and everything works fine. While I am trying to test all scenarios, when I try to connect through Facebook auth, there will be a push message notification saying
“your app” wants to use “Facebook.com” to sign in.
Well if I press continue it work fine but if I press cancel my
Let credential = FacebookAuthProvider.credential(withAccessToken:FBSDKAcessToken. Current().tokenString)
is returning nil. I tried to unwrap but it didn’t work. Anyone knows how to fix it please. I appreciate your help.
I found the solution which is to verify that FBSDKAccessToken.current() is not nil before creating the credential variable
Related
I recently updated to the newest version of Xcode and I've got a lot of problems since then. I've a "Sign up" form where user can create a new account on the app but somehow it does not insert new values into the Authentication.
I commented out my code and just tried to run the normal create user function so my code looks like this right now:
Auth.auth().createUser(withEmail: txtfield_email.text!, password: txtfield_password.text!) { (adr, err) in
if let err = err{
print(err.localizedDescription)
}else{
print("Succeded creating a new user!")
}
}
So when I run the app it will go into the else and print out: "Succeded creating a new user!" but when I login to my Firebase account and check if any new values is added to the authentication the answer is no. Nothing is there.
I've updated all my pods including the Firebase and still does not work.
What could of happen? Why doesn't it run like normal?
Just to mention: I'm currently running it on the simulator (Not my own device). But like I said, nothing new is getting implemented in Authentication. (Everything worked perfectly fine before, but not after I updated...?)
I've been struggling on this for hours and hours. But once I posted this thread I found my solution.
If you find this error yourself the solution is.
Go to your console in Firebase and download the latest version of:
GoogleService-info.plist
And replace your current one with the latest.
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.
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
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.
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.