How to handle errors from Quickblox iOS SDK? - ios

I got this message from quickblox ios sdk,
{
errors = {
email = (
"has already been taken"
);
};
}
I'm not sure how to handle error with quickblox? Is there a list of error messages that I can by forget the issue? I got to print this message with help of QBResponse object like this,
NSLog(#"%#",response.error.reasons);
Here reason is a NSDictionary, how do I know which error message key is inside?
At the same time, I got this message Expected status code in (200-299), got 422 for NSLog(#"%#",response.error.error.localizedDescription);

You should check localizedRecoverySuggestion at first, if nil is there, than you should look for reasons dictionary. Unfortunately there are no standard keys that you could expect.

Related

How to customize error message on Siri intent response of type `failureRequiringAppLaunch`

I'm adding a Siri intent to my app for it to be used within the Shortcuts app. The user needs to be logged in in order to use the intent. When he is not, I send a failure completion with the code .failureRequiringAppLaunch.
For classic errors, ie not needing the app to be launched, I added a String property to customize the error message for the user.
Unfortunately, when I call the completion with the .failureRequiringAppLaunch code, the error message is not displayed, and the message "An unknown error occurred." is displayed to the user:
Here is my code:
let intentResponse = AllMeetingsIntentResponse(code: .failureRequiringAppLaunch, userActivity: nil)
intentResponse.failureReason = "You must log in to use this function."
return intentResponse
So if someone is able to tell me how I can customize the "app launch" alert, thanks in advance.
You can customize your error message by doing the following:
let response = AllMeetingsIntentResponse.failure(failureReason: "Fail because Bla bla bla")
completion(response)
I hope it helped you

Not able to sign in with AWSMobileClient iOS. Getting AWSMobileClientError error 13

I'm using the AWSMobileClient on iOS for authentication and I'm not able to sign in. I'm calling the signin method and all I'm getting is the following error:
The operation couldn’t be completed. (AWSMobileClient.AWSMobileClientError error 13.)
This error is useless to me and I can't find any decent documentation on what this error means. Has anyone seen this? Appreciate your help.
Please take a look at this https://github.com/aws-amplify/aws-sdk-ios/issues/1538#issuecomment-491905913
You can cast the error as AWSMobileClientError and switch on it to exhaust the list of errors.
Alternatively, I've moved over the internal message property over to my app like this:
https://github.com/lawmicha/iOS-User-Authentication-with-Email-Facebook-Google/blob/master/AmplifyUserAuthentication1/Internal/ErrorMapper.swift
extension AWSMobileClientError {
var message: String {
switch self {
case .aliasExists(let message),
.badRequest(let message),
and then I can access the message on error after casting it to AWSMobileClientError from if let error = error as? AWSMobileClientError
You should keep in mind that the alternative method exposes the message which is a developer facing message and not a end-user facing message. Ideally when you need to provide an end-user facing message, you would use first method and map the error case to a specific localized message.

iTunes Connect submit for review - Your app information could not be saved. Try again

I get this error message when trying to submit a new version of my app for review:
While I've seen other threads about this error message, the solutions presented haven't worked for me and I haven't seen any mentions of the actual server error message I get. iTunes Connect responds with the following error message:
Error converting JSON string to object: Can not instantiate value of type [simple type, class com.apple.jingle.label.content.purple.to.LCSubmitForReviewTO] from JSON integral number; no single-int-arg constructor/factory method
Request details:
Remote Address:23.1.186.88:443
Request URL:https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/apps/123456789/version/submit/complete
Request Method:POST
Status Code:500 Internal Server Error
Full JSON response:
{
"data":null,
"messages": {
"warn":null,
"error":[
"Error converting JSON string to object: Can not instantiate value of type [simple type, class com.apple.jingle.label.content.purple.to.LCSubmitForReviewTO] from JSON integral number; no single-int-arg constructor/factory method"
],
"info":null
},
"statusCode":"ERROR"
}
I've tried clearing all cookies, and also changing to another browser, and I've also tried removing the build and adding it again, but I get the same issue regardless. Has anyone else had this exact problem? Did anyone find a way around it?
I just tried submitting my app again, after 12 hours of being unable to. It worked!

Get partial errors from NSError

When using CloudKit, sometimes the error returned is PartialFailure, which may caused by duplicate subscriptions, etc. See example below.
<CKError 0x7f8318711520: "Partial Failure" (2/1011);
"Failed to modify some subscriptions"; uuid = A434B010-7650-4BBA-8A7A-33CD0690FD15;
container ID = "iCloud.xxx.xxx"; partial errors: {
EFC65F4A-A595-44A3-A022-323D9CE9B535 = <CKError 0x7f831a007be0: "Server Rejected Request" (15/2032); server message = "subscription is duplicate of '_930081460_AA87A676-DE57-4530-8BB8-7465BF4F4303'">
C4913907-28F3-42DB-8455-9966D9084834 = <CKError 0x7f83185cfc20: "Server Rejected Request" (15/2032); server message = "subscription is duplicate of '_930081460_F92FA91D-3E92-4E46-AE59-E912F8871026'"> }>
I wish to retrieve these partial errors from the main error object but I don't know how. NSError doesn't have a partialError property, and it neither has a key in userInfo to retrieve that.
You aren't getting back a straight NSError, you are getting back a CKError. Looking at the documentation for CKError, there is in fact a CKPartialErrorsByItemIDKey key. That looks like the key that would return a dictionary of CKErrors keyed by item ID if you ask me! The userInfo object should contain that key.
Also documented here
CloudKit Framework Constants Reference
Two years later, and I still don't think how to access partial errors is particularly well documented. Thanks to #Acey for putting me on the right path with CKPartialErrorsByItemIDKey
For those who are struggling, here is an example of how I ended up accessing a partial error in a CKModifySubscriptionsOperation (Swift 2.2):
someZoneSubscriptionOperation.modifySubscriptionsCompletionBlock = {(savedSubscriptions: [CKSubscription]?, deletedSubscriptionIDs:[String]?, operationError:NSError?) in
// check specifically for an error in changing subscriptions to custom zone with specific subscriptionID
if let partialError = operationError?.userInfo[CKPartialErrorsByItemIDKey]?[subscriptionID] as? ErrorType {
print(partialError) // prints partial error for custom zone with `subscriptionID` if it exists
}
}

How to avoid the "Duplicate status message" error in using Facebook SDK in iOS?

I want to post the several same messages onto my feed/wall in an iOS application.
From the 2nd try, I receive this error -
(#506) Duplicate status message.
How can I solve it?
You can't.
That is Facebook's way to tell you to stop spamming.
Sorry if it sounds slightly mean - but posting the same message over and over and over again is spamming, and its not good. The error message you are getting describes the problem - you are posting the same status message. It is a special error message created specifically for this case.
I check for the 506 code and don't show any error to the user in case it's a duplicate status error
if (error && [[[[[error.userInfo objectForKey:#"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:#"body"]objectForKey:#"error"]objectForKey:#"code"] intValue] !=506) {
alertTitle = NSLocalizedString( #"SomethingWentWrongTitle", nil);
}

Resources