Swift Screen time Api error (family controls error code=2 ) - swift

I'm try to physical device always getting error on Error for Family Controls: Error Domain=FamilyControls.FamilyControlsError Code=2 "(null)"
AuthorizationCenter.shared.requestAuthorization { result in
switch result {
case .success():
break
case .failure(let error):
print("Error for Family Controls: (error)")
}
}

check out this link at Apple Developer Forums
it says:
Requesting FamilyControls authorization on Simulator is supported by the ScreenTime API.
FamilyControlsError Code=2 is the error code for an invalid account type; this is expected when trying to authorize FamilyControls on a non-child iCloud account.
FamilyControlsError Code=3 is an internal error, which isn't expected.
I hope it'll help you. Have a nice day mate !

Related

Apple Music API not letting me get User Token - Throwing Unknown Error

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.

In App Purchases failed by user on apple ID dialogue

I have a scenario with some steps as follow:
Restore Purchase Method called
Restore Results are fetched
Dialogue for apple ID and password canceled by user
results.restoreFailedPurchases.count > 0
After that restoreFailed result is follow
SKErrorCode(_nsError: Error Domain=SKErrorDomain Code=2 "Cannot
connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot
connect to iTunes Store})
How can I get the user info object form that for error message accordingly?
You need to unpack the SKError to determine what the underlying error is. In the example you posted, code=2 means the user cancelled.
if let error = error as? SKError {
switch error.code {
case .paymentCancelled:
// Handle user cancelled
default:
break
}
}
SKErrorCode documentation: https://developer.apple.com/documentation/storekit/skerrorcode

HealthKit Authentication Error (Code = 3)

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

How to resolve Firebase error for oAuth in Swift. FIRAuthErrorDomain Code=17999

My create auth user method is no longer working and I’m getting an error that I haven’t seen before. I checked the GoogleService-Info.plist and all the values match my firebase dashboard. Even re-downloaded it to be sure. I’ve toggled the Sign-in method and also enabled the Identity Toolkit API from the Google Cloud Platform.
Found some okay answers on Stack Overflow but didn’t relate to the ‘status = “PERMISION_DENIED” internal error. Any feedback would be great! - Here is the full error message
Error creating Auth createUserWith(email:password:completionUser:completion:)
Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred,
print and inspect the error details for more information." UserInfo= .
{error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has
occurred, print and inspect the error details for more information.,
NSUnderlyingError=0x60400025f7d0 {Error Domain=FIRAuthInternalErrorDomain
Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
code = 403;
errors = (
{
domain = global;
message = "Requests to this API identitytoolkit method google.firebase.auth.v1.IdentityIdaasAuthenticationService.SignUp are blocked.";
reason = forbidden;
}
);
message = "Requests to this API identitytoolkit method google.firebase.auth.v1.IdentityIdaasAuthenticationService.SignUp are blocked.";
status = "PERMISSION_DENIED";
}}}} An internal error has occurred, print and inspect the error details for more information.
Here's a screen shot of my code and the rules in Firebase.
I add the domain that I was using in firebase console. That worked for me. https://support.google.com/firebase/answer/6400741?authuser=0&hl=en

iPhone GameKit: Communication with Sandbox - GKErrorDomain Code 3

Anyone has any experience with GameKit GKErrorDomain Code 3? I receive the error message when I try to upload a score to a leaderboard in the Sandbox. The iOS reference library just says that Indicates that an error occurred when communicating with Game Centre The Here is the full error message:
Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x75e4eb0 {NSUnderlyingError=0x7531e00 "The operation couldn’t be completed. status = 5053", NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server
The environment:
The request is being made from the 4.1 Simulator
GameKit has authenticated the local player who has logged into the Sandbox
The leaderboard with the name "Standard" has been created on iTunes connect
I can browse the web in the simulator
Here is the code I use to upload the score
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:#"Standard"] autorelease];
scoreReporter.value = 10;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error)
{
if (error != nil)
{
// handle the reporting error
NSLog(#"An error occured reporting the score");
}
else
{
NSLog(#"The score was reported successfully");
}
}];
One reason (which is the reason that was affecting me) for GKDomainError Code 3 is if the Leaderboard Category Id specified in the initWithCategory message when initializing GKScore is incorrectly specified.
It's easier to track down if you print out the error.
Etc:
NSLog(#"An error occured reporting the score: %#", error);