issue while Logging-In using Parse - ios

I have made an app is which user can sign-in and sign-up using Parse.
But I am unable to to sign-in.
I copied the login-code from Parse
The code is:
- (IBAction)didTapLogin:(id)sender
{
[PFUser logInWithUsernameInBackground:#"Rahul#gmail.com" password:#"mypass"
block:^(PFUser *user, NSError *error) {
if (user) {
NSLog(#"SUCCESS");
} else {
NSLog(#"%#",error);
}
}];
}
I have set Up the Keys already in App-Delegate.m
I am getting following Error:
[Error]: invalid login parameters (Code: 101, Version: 1.7.2)
Error Domain=Parse Code=101 "The operation couldn’t be completed. (Parse error 101.)" UserInfo=0x7feefa437070 {code=101, temporary=0, error=invalid login parameters, originalError=Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)"}
What's the issue in code.As I have done nothing with it.

Related

Get error while fetching user details from Twitter SDK after few logins

I am doing following code for get user details from Twitter. But, after few hours, I get error and I cannot get user details at that moment. Next day. I am able to get those details and after few logins, again I get error:
TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
[client loadUserWithID:userID completion:^(TWTRUser *user, NSError *error) {
if(error)
{
completionBlock(nil, error);
}
else
{
NSDictionary *dicUser = #{ kTWTRIdStr : user.userID,
kTWTRScreenName : user.screenName,
kTWTRNameParam : user.name,
kTWTRProfilePicURL : user.profileImageURL
};
completionBlock(dicUser, nil);
}
}];
I am getting following error:
Error: Error Domain=TwitterAPIErrorDomain Code=99 "Request failed:
forbidden (403)" UserInfo={NSLocalizedFailureReason=Twitter API error
: Unable to verify your credentials (code 99),
TWTRNetworkingStatusCode=403,
NSErrorFailingURLKey=https://api.twitter.com/oauth2/token,
NSLocalizedDescription=Request failed: forbidden (403)}

Amazon s3 Image Upload (cognito id null)

Image is not uploading in a amazon s3 . I was using the old library all the upload was working fine but for ios 8 i use new sdk and create new conginito id
now i am facing errors. any help will be appreciated
My code is
AWSS3TransferManagerUploadRequest *request = [[AWSS3TransferManagerUploadRequest alloc] init];
request.bucket = #"my bucket name";
request.key = #"my cognitio id";
request.body =[NSURL fileURLWithPath:path];
request.contentType = #"image/png";
[[transferManager upload:request] continueWithExecutor:[BFExecutor mainThreadExecutor]
withBlock:^id(BFTask *task) {
NSLog(#"ckmdkcd dvdsv");
if (task.error) {
if ([task.error.domain isEqualToString:AWSS3TransferManagerErrorDomain]) {
switch (task.error.code) {
case AWSS3TransferManagerErrorCancelled:
case AWSS3TransferManagerErrorPaused:
break;
default:
NSLog(#"Error: %#", task.error);
break;
}
} else {
// Unknown error.
NSLog(#"Error: %#", task.error);
}
}
if (task.result) {
AWSS3TransferManagerUploadOutput *uploadOutput = task.result;
// The file uploaded successfully.
NSLog(#"result = %#",task.result);
}
return nil;
}];
I got the following response
AWSiOSSDKv2 [Error] AWSIdentityProvider.m line:185 | __51-[AWSAbstractCognitoIdentityProvider getIdentityId]_block_invoke169 | GetId failed. Error is [Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}]
2015-04-14 08:13:16.326 newtest[6611:172200] AWSiOSSDKv2 [Error] AWSCredentialsProvider.m line:534 | __40-[AWSCognitoCredentialsProvider refresh]_block_invoke350 | Unable to refresh. Error is [Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}]
2015-04-14 08:13:16.328 newtest[6611:172071] ckmdkcd dvdsv
2015-04-14 08:13:16.328 newtest[6611:172071] Error: Error Domain=NSURLErrorDomain Code=-1003 "The operation couldn’t be completed. (NSURLErrorDomain error -1003.)" UserInfo=0x7f9b987aabf0 {NSErrorFailingURLStringKey=https://cognito-identity.(null).amazonaws.com/, NSErrorFailingURLKey=https://cognito-identity.(null).amazonaws.com/, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSUnderlyingError=0x7f9b9a839480 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1003.)"}
I am also setting cognitio id in app delegate.
Based on the fact that you seeing https://cognito-identity.(null).amazonaws.com/ in the error, it would lead me to believe you are not correctly setting the region when creating the AWSCognitoCredentialsProvider. Please double check that you are not setting this to AWSRegionUnknown.
Update 2015-04-17: Here is the list of Region constants. You should set this to the region where your identity pool exists. Currently Amazon Cognito is only available in AWSRegionUSEast1 or AWSRegionEUWest1.
Note, the region of your identity pool has nothing to do the region of other AWS services you may use in your application. You can use an identity pool in AWSRegionUSEast1 to access resources in AWSRegionSAEast1, for instance.

NSURL Error code extraction

I try to do my NSURL error-handling and have a little problem.
When i'm getting an error i want to handle it different for different error-codes.
In my case i want to check if the error that i'm getting is the one with errorcode 1005.
This is what I get when I print as follows:
NSLog(#"%#",error);
Error Domain=NSURLErrorDomain Code=-1005 "The operation couldn’t be completed. (NSURLErrorDomain error -1005.)" UserInfo=0x1700ff000 {NSErrorFailingURLStringKey=MyURL, NSErrorFailingURLKey=MyURL, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSURLSessionDownloadTaskResumeData=<CFData 0x17025a580 [0x1936b2c80]>{length = 3640, capacity = 4096, bytes = 0x3c3f786d6c2076657273696f6e3d2231 ... 2f706c6973743e0a}, NSUnderlyingError=0x17025cf80 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)"}
and this is what I want to extract from it:
-1005
I already searched for it and found a solution which doesn't work. (I get EXC_BAD_ACCESS)
NSLog(#"%#", [error code]);
Afterwards I want to compare it similar to:
if(error.code == -1005){
//handle error
}
You can't use:
NSLog(#"%#", [error code]);
Because code is NSInteger. Use:
NSLog(#"%d", [error code]);
Refer: NSError Class Reference for more details

Can't delete a Parse PFObject?

I'm having trouble deleting an object... Confused why it can't find it because I am already collecting data from it from Parse to the user's device. I'm getting 2 error messages. One for the first deleteInBackground, and then again for deleteEventually:
1) Error: object not found for delete (Code: 101, Version: 1.2.19)
2) runEventually command failed. Error:Error Domain=Parse Code=101 "The operation couldn’t be completed. (Parse error 101.)" UserInfo=0x17d16150 {code=101, error=object not found for delete}
Here's my code on how I am deleting:
PFObject *parseMessage = [objects objectAtIndex:i];
SentMessage *newMessage = [[SentMessage alloc] initNew:parseMessage[#"senderEmail"] :parseMessage[#"senderName"] :Kjell.savedData.userEmail :Kjell.savedData.userDisplayName :parseMessage[#"message"]];
[newMessage setTimeReceived:[NSDate date]];
[newMessage setTimeSent:parseMessage[#"dateSent"]];
[[[Kjell.savedData.recentUserArray objectAtIndex:j] conversationArray] addObject:newMessage];
[parseMessage deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (!succeeded)
{
[parseMessage deleteEventually];
}
}];
any help would be great.
Once ensured that object really exist server side, check if ACL is property set for it, so that current logged user ( client side ) can affect that object for edit or delete

Accessing localized error message from ASIHTTPrequest calls

I'm using the ASIHTTPRequest to perform some HTTP calls. In a certain case when the network isn't available, I display a dialog with the error from the NSError object returned. My problem occurs when I change my language settings (to Spanish). The localizedDescription always returns in English:
NSLog(#"userInfo: %#", [error userInfo]);
NSLog(#"localizedDescription: %#", [error localizedDescription]);
prints:
2012-04-05 22:02:05.519 MyApp[18644:207] userInfo: {
NSLocalizedDescription = "A connection failure occurred";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=61 \"The operation couldn\U2019t be completed. Conexi\U00f3n rechazada\" UserInfo=0x594f880 {}";
}
2012-04-05 22:02:05.519 MyApp[18644:207] localizedDescription: A connection failure occurred
localizedDescription is still in English, but inside [error userInfo], in the NSUnderlyingError, there is a Spanish translation available, but I don't know how to access it via the NSError object returned.
A similar question was previous asked, but the answer is not satisfactory and not scalable for all possible error messages.

Resources