When I try to authenticate access to write to a user's mindful minutes store (health app) from the onboarding in my own app, the authentication page doesn't display (although I did have this working in previous versions of the app). The app however doesn't crash and there is only the following message in the debugger:
Error Domain=com.apple.healthkit Code=3 "Failed to look up source with bundle identifier "com.myorg.myapp"" UserInfo={NSLocalizedDescription=Failed to look up source with bundle identifier "com.myorg.myapp"}
The code I am using to request the authentication is as follows:
let typesToShare = Set([
HKObjectType.categoryType(forIdentifier: HKCategoryTypeIdentifier.mindfulSession)!
])
self.healthStore.requestAuthorization(toShare: typesToShare, read: nil) { (_, error) -> Void in
if let error = error {
print("\(error)")
}
DispatchQueue.main.async {
self.performSegue(withIdentifier: "openWalkthroughThree", sender: self)
}
}
I have searched around the internet but can't seem t find anyone with the same issue. I have also checked my entitlements for HealthKit as well as usage description but they both seem to be fine - as I said, I had this working in previous versions of my app.
I would be grateful for any help you could give me in finding a solution to this problem.
Not sure what's going on but simply restarting my device fixed this issue.
Also see: Missing HealthKit Entitlement
Related
I have been using Firebase Auth (phone) in the app for a long time and have never had a problem
Today a user got that error on iOS device
The OAuth client ID provided is either invalid or does not match the specified API key
Since only one user got this error, I need to debug this carefully
PhoneAuthProvider.provider().verifyPhoneNumber(
number.getFormattedPhoneNumber(format: .E164)!,
uiDelegate: nil,
completion: { verificationID, error in
DispatchQueue.main.async {
if let error = error {
//print error
}
//logic
}
})
I use the above code to verify the phone number
What could cause that error on that user's device?
EDIT: I updated the app with iOS 15 SDK Xcode and the user that had this issue has iOS 14, could be any relation between them?
I am trying to create a very simple app using Apple's Apple Music API in Swift. To do this, I need to retrieve songs from Apple Music. I am trying to get a user token using this code
SKCloudServiceController().requestUserToken(forDeveloperToken: "[DEV TOKEN HERE]") { (userToken, err) in
if let e = err {
print(e)
}
if let token = userToken {
print(token)
}
}
Right now I am just trying to print the token, but every time I call this function I am met with this error in console
Error Domain=SKErrorDomain Code=0 "An unknown error occurred" UserInfo={NSLocalizedDescription=An unknown error occurred}
I am confident that it is not my Dev Token because that usually throws a 'Cannot Connect to iTunes' error and I have tried substituting random strings for my dev token just to get the same error.
I've looked around but I cannot find an answer to this, has anyone else encountered it or have any idea how to fix it?
Thank you!
P.S I am not too familiar with posting on Stack Overflow so if I made some mistake please let me know so I can correct it!
Same here. It worked before 14.2. Developer Token is valid, I checked Dev Center.
I'm trying to setup password-less email authentication through firebase for my iOS app. I'm using the method send signInLink which require actionCodeSettings and in turn a url. I've discovered that this url has to be a dynamic link created on Firebase. I've gone to the firebase console and white-listed a domain, but when I try to create the dynamic link on the console, I get "An error occurred when creating new dynamic link".
I'm a little confused as to how I'm supposed to construct this dynamic link especially the deep link. I've been through Firebase's documentation, added a dummy App Store ID and App prefix (as I was told by Firebase support), but I can't seem to get a proper diagnosis behind this
If I try sending the sign-in email there is no issue, but when I click on the link I get a 400 error saying "The requested URL was not found on this server".
Can anyone help me out with this?
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.url = URL(string: String(format: "my_dynamic_link", email.text!))
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
actionCodeSettings.setAndroidPackageName("", installIfNotAvailable: false, minimumVersion: "12")
Auth.auth().sendSignInLink(toEmail: email.text!, actionCodeSettings: actionCodeSettings, completion: { error in
if error != nil {
print("Link Error: " + (error?.localizedDescription)!)
let castedError = error as NSError?
let FBError = AuthErrorCode(rawValue: (castedError?.code)!)
switch FBError {
case .invalidEmail?:
print("invalid email")
case .emailAlreadyInUse?:
print("in use")
default:
print("Create User Error: \(error!)")
}
}
else {
print ("No Error")
}
})
You could try following the troubleshooting steps mentioned in the Firecasts video "Getting started with Firebase Dynamic Links on iOS - Pt.1 (Firecasts)" at 7:54 (https://youtu.be/KLBjAg6HvG0?t=474).
I was having the same issue and everything worked fine after:
deleting the app
restarting my phone
reinstalling the app
Currently the bug radar (http://www.openradar.me/radar?id=4999496467480576) is still open.
I have successfully saved a CKShare URL to CloudKit, and I can see that the user is INVITED in the CloudKit Dashboard. My Mac app emailed the URL to that person, but when they click it, all they see it this screen on icloud.com:
Clicking OK makes everything disappear so all you see is the background on the web page.
My understanding is that the URL is supposed to open my Mac app where it will fire userDidAcceptCloudKitShareWith in my app delegate. But it does nothing.
Could this be because my app is in development and not in the Mac App Store yet? Do I need a custom URL scheme to get it to open my app?
Documentation on this stuff is pretty sparse. I'd love any help someone can provide.
I have since learned that you must specify a fallback URL for your CloudKit container. In cases where the app isn't installed (or isn't recognized, which seems to be the case when doing dev builds in Xcode like I am), CloudKit will forward share URL to somewhere you specify. They append the unique share ID to the URL so that you can process it on your own web page.
In the CloudKit dashboard, go to Environment Settings... and you'll see this popup:
I have it redirect to https://myapp.com/share/?id= and on my web page where it redirects to, I do a $_GET['id'] to grab the id. I then do another redirect to my application using a custom URL scheme and pass the share ID (e.g. myapp://abc123 where abc123 is the share ID).
In my app delegate, I receive the URL like this:
func application(_ application: NSApplication, open urls: [URL]) {
if let url = urls.first, let shareId = url.host{
fetchShare(shareId) //<-- sharedId = abc123
}
}
I then use CKFetchShareMetadataOperation to look up the URL of the share and CKAcceptSharesOperation to accept it like this:
func fetchShare(shareId: String){
if let url = URL(string: "https://www.icloud.com/share/\(shareId)"){
let operation = CKFetchShareMetadataOperation(shareURLs: [url])
operation.perShareMetadataBlock = { url, metadata, error in
if let metadata = metadata{
//:::
acceptShare(metadata: metadata)
}
}
operation.fetchShareMetadataCompletionBlock = { error in
if let error = error{
print("fetch Share error: \(error)")
}
}
CKContainer.default().add(operation)
}
}
func acceptShare(metadata: CKShareMetadata){
let operation = CKAcceptSharesOperation(shareMetadatas: [metadata])
operation.acceptSharesCompletionBlock = { error in
if let error = error{
print("accept share error: \(error)")
}else{
//Share accepted!
}
}
CKContainer.default().add(operation)
}
I think there are easier ways to work through this using NSItemProvider and NSSharingService, but I'm doing a lot of custom UI and wanted to have full control of the share workflow.
I hope this helps someone. :)
I am trying to implement a simple Facebook login with Parse, Swift, and iOS 8.
I have followed the Parse documentation (to the best of my ability) and am getting stuck on what seems to be the simplest aspect...logging in.
I have:
Created Parse account
Created Facebook developer account
Linked the two via Parse settings
Added the frameworks to my project
Added the initialization calls to my app delegate
Then added the following code to my viewdidload function:
var permissions = ["public_profile"]
PFFacebookUtils.logInWithPermissions(permissions, {
(user, error) -> Void in
if user == nil {
NSLog("Uh oh. The user cancelled the Facebook login.")
} else if user.isNew {
NSLog("User signed up and logged in through Facebook!")
self.performSegueWithIdentifier("signUp", sender: self
} else {
NSLog("User logged in through Facebook!")
}
})
I get the following error when I run my project:
[PFUser _logInWithAuthTypeInBackground:]: unrecognized selector sent to class 0x1002def88
2014-11-03 11:56:41.006 TestApp[9288:3511774] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[PFUser _logInWithAuthTypeInBackground:]: unrecognized selector sent to class 0x1002def88'
Any help would be appreciated on this one...I am at a loss.
Thanks
Dennis
You should specify what user and error are.
Like this:
PFFacebookUtils.logInWithPermissions(permissions, {
(user: PFUser!, error: NSError!) -> Void in
// your stuff.
})
}
I was having the same issue on my project. I'm using CocoaPods and had Parse 1.4 and Facebook-IOS-SDK 3.19. I updated my libraries to the latest (using pod update) and that seemed to work for me.
have you checked that "signUp" is spelt correctly? I see this all the time. Might be worth checking your code
NSLog("User signed up and logged in through Facebook!")
self.performSegueWithIdentifier("signUp", sender: self