Where can I view my PFUser objects in the Parse Data Browser? - ios

I'm getting to know Parse and am already having a tough problem.
I'm working with the User Login flow. I need to be able to delete the User object I've just created. Problem is, on the Dashboard, I only have the Installation data table.
I realized I wasn't explicitly saving this user object, although locally (on iOS) I could log in with the currentUser object credentials. So I thought I'd remove the install from the simulator and try again (hey, since my data wasn't on the dashboard.)
Now I tried re-installing the app, using the same username/pass, and Parse SDK is telling me these are already taken!
So the question is, where is this User, and how do I completely remove the data so I can start over again?
2015-10-15 16:37:29.999 ParseApp[21428:2003831] [Error]: username myUserName already taken (Code: 202, Version: 1.8.5)

This doesn't solve the problem, but is kind of like a workaround for testing purposes. I made a method:
- (IBAction)pressedDeleteSelf:(id)sender
{
[[PFUser currentUser] deleteInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
if (succeeded) {
[PFUser logOut];
[self performSegueWithIdentifier:#"unwindSignedOut" sender:self];
}
}];
}
Which then allows me to re-create a user with the same credentials. I still have no idea why the PFUser table does not show up in the Dashboard.

Oh myyy... how silly do I feel. With all these different tutorials I've been running, apparently I had been doing all this stuff using the wrong AppID and Client Key. A rookie mistake, but hopefully someone else doesn't have to trip on this.
To be clear, solution is to make sure your App ID and Client key in the Parse dashboard match what you call in code:
// Initialize Parse.
[Parse setApplicationId:PARSE_APP_ID
clientKey:PARSE_CLIENT_KEY];
Embarrassed...

Related

MSGraphSDK user details API callback not responding back when user password changed in iOS

I tried to get the user details using MSGraph SDK in iOS using below API method. Iam successfully received the user details all the time. But when user charged their password or update their credentials, i received the oauthConnection Error: only in log. And i didn't receive any call back in the below API. Why it is not responding back when any kind of error occurred? Please help me. Thanks in advance.
[MSGraphClient setAuthenticationProvider:self.authProvider.authProvider];
self.graphClient = [MSGraphClient client];
[[[self.graphClient me]request]getWithCompletion:^(MSGraphUser *response, NSError *error) {
if(!error){
// Im able to get back here
}
else{
//Im not received any call back here when user changed their password or any error occurred.
[self.authProvider disconnect];
}
}];`
I am kinda new to MS Graph, so I might be missing something, but your graphClient declaration seems a little bit poor to me.
Try to download this sample: https://github.com/Azure-Samples/active-directory-dotnetcore-daemon-v2
And check it's declaration of graphClient.
You might be missing the part which refreshes the token?

AWS Cognito Update user login issue in iOS

I am working on AWS Cognito login. It works fine in all cases such as SignUp, signIn, Forgot password etc. But it edit profile case, I am facing some technical problems. I edited my mobile number successfully.
In one of the case I provide wrong number and it throws an error like this,
[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body: {"__type":"InvalidParameterException","message":"Invalid phone number format.”}
I am using this set of code to update my profile,
[[user updateAttributes:#[attributes]] continueWithSuccessBlock:^id _Nullable(AWSTask<AWSCognitoIdentityUserUpdateAttributesResponse *> * _Nonnull task) {
//success
return nil;
}];
It provides only success responses. Failure responses are not coming inside this block. Can anyone help me how to get failure messages in this. I tried so many ways but still troubling to get proper solution. Any help will be appreciated. Thanks.

Sending data back from cloud code

I use Stripe in Parse Cloud Code and receive a Stripe ID (String), but I want to send that stripe id back to Xcode. What is the best way of doing this?
I've tried to first of all send the stripe ID to Parse, and in Xcode I do a fetch...
But I think that's a bad idea because if there are multiple users processing the payments at same time, it's hard to get the right stripe ID for the user.
To return data from cloud code, take a look at this tutorial post.
Basically all you have to do is return the stripe id like this
response.success(stripeId);
Receiving data looks like this :
[PFCloud callFunctionInBackground:#"averageStars" withParameters:params block:^(NSString *stripeId, NSError *error) {
if (!error) {
// code
}
}];

Parse error codes 209 and -34018

I have spent several hours learning user management on Parse, thinking it would be easy considering it's been an established service for so long.
There is poor documentation around 'automatic user' and sessions.
I am trying to build an App that allows the user to exist anonymously (using [PFUser enableAutomaticUser]), before they decide to sign up.
Registration Steps:
Gather user details from the UI
Log out current automatic user and wait for success
Upon success create a user object using [PFUser user] and assign values
Call signUpInBackgroundWithBlock on the new user instance
I sometimes get the following errors (yes, only sometimes), when doing the above.
[Error]: PFKeychainStore failed to get object for key 'currentUser', with error: -34018
[Error]: invalid session token (Code: 209, Version: 1.7.0)
I also end up with a dirty database, because I don't know how to delete the automatic user that was previously created. I tried keeping the object id of the old user around and using deleteEventually but that didn't work?
Any advice on how you would go about achieving this would be great.
Take a look at this issue with parse on iOS: https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/437.
I believe this was an issue in iOS and is now fixed
Actually, this is a bug of keychain, you can search it at github.
Github 34018 issues
A few months ago, some apple's staff came our company to give us a course, after course,we asked this question, they also did't give us a solution
I've solved this problem by using the following:
PFUser *user = [PFUser currentUser];
[user refreshInBackgroundWithBlock:^(PFObject *object, NSError *error) {
if (!error) {
NSLog(#"Succesfully refreshed the current user.");
} else {
NSLog(#"Failed to refresh the current user with error %#", error);
}
}];
It seems that [PFUser currentUser] returns an invalid session token which is causing the 209 and -34018 errors. This is only an issue when the current user is an anonymous user.

AWS DynamoDB iOS SDK silently failing but always returning success status

I've created an iOS application following AWS Mobile SDK examples using AWSiOSSDKv2.
I've successfully been able to connect with an unauthorized Cognito account to DynamoDB and write to the table. I log into AWS, check the table and see my records are there.
AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
[[dynamoDBObjectMapper save:tableRow] continueWithSuccessBlock:^id(BFTask *task) {
if (!task.error) {
NSLog(#"Successfully inserted the data into the table.");
} else {
NSLog(#"Failed to insert the data into the table.");
}
return nil;
}];
However, now I want to test what will happen in a failure. I deliberately try to cause an error by changing the dynamoDBTableName to something that does not exist. Unfortunately, my code always returns success even tho it was not.
I found in another thread someone recommending putting logging to verbose which I did.
[AWSLogger defaultLogger].logLevel = AWSLogLevelVerbose;
And in the console, I do see that AWSLogger displays an error:
[{"__type":"com.amazon.coral.service#AccessDeniedException","Message":"User:
arn:aws:sts::xxxxxx:assumed-role/Cognito_xxxxxxxxUnauth_DefaultRole/iOS-Provider
is not authorized to perform: dynamodb:PutItem on resource:
arn:aws:dynamodb:us-east-1:xxxxxxxxxxxxx:table/xxxxxxxx"}]
However, In my code above, it always writes "Successfully inserted the data into the table.".
I've even tried modifying AWS Mobile Examples and can reproduce the same bug. I've also tried installing the POD and manually adding the AWSiOSSDKv2 framework to my project, neither fix the issue.
Has anyone run into this issue and does anyone know how to resolve? I'm trying to create an unauthorized user who only has write access to the dynamodb table.
Thanks
This is a known issue of the SDK, and the fix is on its way.
In the meanwhile, if you are using CocoaPods, adding the following lines to AWSDynamoDBObjectMapper.m L154 should fix it:
if (task.error) {
return task;
}

Resources