I have been trying to implement Apple ID Sign in for both iOS and tvOS applications. iOS is able to sign in with Apple ID just fine, but whenever I tried to sign in through our tvOS app, it shows a generic unknown error in the UI (error 1000) and in the debug log, it gives me the following error:
[core] Authorization failed: Error Domain=AKAuthenticationError Code=-7014 "(null)" UserInfo={AKClientBundleID=[bundleID]}
I use this code below that follows the basic steps for Apple ID Sign In:
#IBAction func signInbuttonTapped(_ sender: Any) {
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email]
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()
}
I have "Sign in With Apple" capabilities Turned on in XCode, and our Identifier for tvOS app is using the same Group App ID as the iOS Identifier so it seems to be fine. There isn't any forums that give this exact error. Does anyone know about what error code -7104 means, and what can I do to resolve it? Thank you.
Related
I built a currency converter app, which gets the live currency value through API and display it. Testing on a physical phone my app works fine & no crash.
But whenever I do API call I am getting warning in the simulator as below:
[boringssl] boringssl_metrics_log_metric_block_invoke(144) Failed to log metrics
Here how i used URLSession
func performRequest(finalUrl: String) {
if let url = URL(string: finalUrl) {
let session = URLSession(configuration: .default)
let task = session.dataTask(with: url) {(data, response, error) in
if error != nil {
print("error in network session \(error!)")
return
}
if let safeData = data {
parseJason(dataUrl: safeData)
}
}
task.resume()
}
}
I have tried changing some values but nothing works
OS_ACTIVITY_MODE = default
DEBUG_ACTIVITY_MODE -> Debug -> any iOS simulator SDK = default
here my doubts are:
How to eliminate this warning?
Can I just ignore this warning?
Will Apple accept my app with this warning?
I had a similar issue, ran the simulator on my actual device instead of the Xcode simulator and had no issue. Problem might be that our simulators are not able to connect to internet, I will look for a solution to that and comment if I find one but on the meantime attempt to run it on your physical device.
How to eliminate this warning?
You can't.
Can I just ignore this warning?
I don't know, can you? It depends on how your brain works. I can ignore it, and I do. It's unimportant. So there is certainly no reason not to ignore it.
Will Apple accept my app with this warning?
Apple will not reject the app because of the warning. Whether they will accept the app is another matter. No one knows what they will do.
I am trying to use firebase google sign in. I have created a view that I set the class to GIDSignInButton. I attached an outlet to it in the view controller, but when I run the app and click on the GIDSignInButton, the app crashes with:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'
Does anyone know how to fix this?
Please try this code in didFinishLaunchingWithOptions method in AppDelegate class:
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
GIDSignIn.sharedInstance().delegate = self
If you not use firebase then you can write:
GIDSignIn.sharedInstance().clientID = "your client id present in googleservice .plist file"
GIDSignIn.sharedInstance().delegate = self
It may helps you. Thank you.
Although I have seen similar questions posted here, I have not been able to resolve my issue via plist settings. Any other ideas? Here is where I am:
Adding FB Login to a simple IOS app using the Parse framework
All versions are up-to-date as of today. XCode 7.1, IOS 9, Parse latest, FB SDK latest (4.7)
I have added the specified IOS 9 settings for the FB SDK in my plist. I even combined the lists to include the extra setting required for FB SDK 4.7.
The mystery:
last night I could not get this to run on my simulator, but after
re-adding the plist settings and re-importing all the libraries, I
finally got the FB login screens to show up on the iphone 6 (has been
upgraded to IOS 9). I couldn't get it to run on the simulator but i
left it at that.
now today i tried it on the iphone again and i keep getting the ATS-looking errors.
On the iphone the error is:
Cannot Verify Server Identity. The identity of "m.facebook.com" cannot be verified by Safari. Review the certificate details to continue.
In the XCode console the error is:
FBSDKLog: WARNING: FBSDK secure network request failed. Please verify you have configured your app for Application Transport Security compatibility described at https://developers.facebook.com/docs/ios/ios9
It seems to me that the plist fix is allowing the FB Login to work in my simulator, but why wouldn't it also work on the iphone? Could this have anything to do with Parse? Below is my login code:
class LoginViewController: UIViewController, PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate, UITextFieldDelegate {
#IBAction func FBLoginButtonPressed(sender: AnyObject) {
// Set permissions required from the facebook user account
var permissionsArray : [String]?
permissionsArray = ["user_about_me"]
var userBlock : PFUserResultBlock?
// Login PFUser using Facebook
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissionsArray, block: userBlock)
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissionsArray) {
(user: PFUser?, error: NSError?) -> Void in
if let user = user {
if user.isNew {
print("User signed up and logged in through Facebook!")
} else {
print("User logged in through Facebook!")
}
self.performSegueWithIdentifier(self.tableViewSegue, sender: nil)
} else {
print("Uh oh. The user cancelled the Facebook login.")
}
if let e = error {
print(error)
}
}
print(userBlock.debugDescription)
}
picture of plist
Okay, the mystery has been solved. Parents of teens may be able to relate.
It turns out that last night when the login was working on my teen's iphone, it was set to use mobile data ON PURPOSE to bypass the content filtering settings on our network! The reason I didn't realize this today was because the FB app seemed to be working on the iphone (upon later scrutiny I see that there was just some cached content), and my mac is set to bypass the content filtering. So this is why it worked on the simulator but not on the iphone (when the iphone was set to use wifi and not mobile data).
So the FB error was a red herring. I just wasn't looking down that path...
Im actually trying to convert Apple's sample code to swift.
I created an app and an APPID for it in the devcenter. I checked the entitlement for HealthKit (the ones for IAP & GC are greyed and checked automatically).
When the provisioning profile I create for it is downloaded to Xcode and I go into Preferences in Xcode and look at my account's provisioning profiles I can see the name of the profile plus the expiration date and then there are some icons for entitlements. But the provisioning profile I created with HealthKit doesnt have any icon for it, just the 2 default ones, is this normal:
because for some reason the app crashes upon requesting authorization with this error:
2014-10-02 12:16:13.241 SwimFit[549:8824] -[__NSCFConstantString _allowAuthorizationForSharingWithEntitlements:]: unrecognized selector sent to instance 0x107dc1ce0
2014-10-02 12:16:13.251 SwimFit[549:8824] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString _allowAuthorizationForSharingWithEntitlements:]: unrecognized selector sent to instance 0x107dc1ce0'
If I try to run it on the device I get this:
I have created:
AppId for my app
Activated that AppID for HealthKit
Created Dev provisioning profile for that AppID
Activated HealthKit Capabilities in General
I see the entitlements.plist is created with com.apple.developer.healthkit = yes
The info.plist does have the healthkit value for required capabilities
The only weird thing I did this time and I used to do differently for other apps is that when I clicked on build/run a some point, I let Xcode create an AppID and I get this from devcenter...i cant upload the image but basically all my previous AppIDs are named after the app. This one because its made by xcode is named: Xcode iOS App ID com santiapps SwimFit but its bundle identifier is correct at: com.santiapps.SwimFit. And so is the dev profile: iOS Team Provisioning Profile: com.santiapps.SwimFit and its the one in my Build Settings. Originally I had SwimFit because that was the name of the app so Xcode created an automatic AppID for it with a ProvProfile for it as well. I then thought maybe I should create the appID and provprofile so I did it manually and tried calling it SwimFit2. Both give the same error.
What else could I be missing?
Here is the code:
//1. Add healthstore property
var healthStore: HKHealthStore? //error if not optionally unwrapped
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//2. Ask for permissions
if (HKHealthStore.isHealthDataAvailable() == true) {
self.healthStore = HKHealthStore() //needs to be var for it to work?
var writeDataTypes = self.dataTypesToWrite()
var readDataTypes = self.dataTypesToRead()
self.healthStore!.requestAuthorizationToShareTypes(writeDataTypes, readTypes: readDataTypes, completion: { (success: Bool, error: NSError!) -> Void in
if (!success) {
NSLog("You didn't allow HealthKit to access these read/write data types. In your app, try to handle this error gracefully when a user decides not to provide access. The error was: %#. If you're using a simulator, try it on a device.", error)
return
} else {
NSLog("success")
}
// Handle success in your app here.
self.setupHealthStoreForTabBarControllers()
})
}
return true
}
Here is a link with a screen capture: http://youtu.be/BBagkNTpfQA
I had the same crash yesterday. The problem is that you put the wrong data type (NSString) for the data types into the method.
The requestAuthorizationToShareTypes method requires you to pass a set of HKBaseType objects, in my case HKQuantityType objects.
So instead of:
[_healthStore requestAuthorizationToShareTypes:[NSSet setWithObject:HKQuantityTypeIdentifierBodyMassIndex]
readTypes:[NSSet setWithArray:inputDataTypes]
completion:
Use this one:
HKQuantityType* type = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMassIndex];
[_healthStore requestAuthorizationToShareTypes:[NSSet setWithObject:type]
readTypes:[NSSet setWithArray:inputDataTypes]
completion:
I'm trying to authenticate the local player using swift, but every time I get a false value for the .authenticated property. Here is the code I'm using, it is called by the main view controller when the app starts.
func authenticateLocalPlayer(){
var localPlayer = GKLocalPlayer()
localPlayer.authenticateHandler = {(viewController, error) -> Void in
if viewController {
self.presentViewController(viewController, animated: true, completion: nil)
}else{
println((GKLocalPlayer().authenticated))
}
}
}
It brings up the log in view just fine, but when I enter a test account login, it just returns the GKLocalPlayer().authenticatedas false. The bundle identifier in iTunes Connect and the info.plist are exactly the same, as is the version and the app name. Everything is enabled for Game Center on iTunes Connect and in Xcode, but I have a feeling it's not a coding error, it's a setup error in the app record somewhere but I can't for the life of me find where.
After further tinkering, I'm getting this error:
Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognized by Game Center." UserInfo=0x17006b300 {NSLocalizedDescription=The requested operation could not be completed because this application is not recognized by Game Center.}
I have no idea why this is the case, the bundle ID, name and versions all match...
Any help would be greatly appreciated.
This issue has been resolved by Apple - just call:
GKLocalPlayer.localPlayer()
Previously, the issue was that GKLocalPlayer() does not return the GKLocalPlayer singleton, but instead returns a new GKLocalPlayer instance.
If you were on the Xcode 6 BETA, you could add a C function or Objective-C method that returns the real GKLocalPlayer singleton, then use this in Swift. This is the gist of my workaround (with bad naming conventions):
In an Objective-C header:
GKLocalPlayer *getLocalPlayer(void);
In an Objective-C implementation:
GKLocalPlayer *getLocalPlayer(void) {
return [GKLocalPlayer localPlayer];
}
In your bridging header:
#import "ThatHeader.h"
Then whenever you need to access the GKLocalPlayer singleton in Swift, you can just use getLocalPlayer() instead of GKLocalPlayer(). It's probably a better idea to stick that in an method of a GKLocalPlayer category.
However, this is no longer necessary as detailed above.
Even with Xcode 6 Beta 6, on a device using iOS 8 beta 5, making GKLocalPlayer.localPlayer() available, I was still getting the error:
"NSLocalizedDescription=The requested operation could not be completed
because this application is not recognized by Game Centre"
The solution (discovered through Apple's Dev forum) was to go to "Settings" on the device, and then into "Game Centre" and enable "Sandbox" under the developer section.
You can use that, I create a simple class for iOS game center in GitHub
Easy Class Game Center Swift
https://github.com/DaRkD0G/Easy-Game-Center-Swift