Amazon s3 Image Upload (cognito id null) - ios

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.

Related

The operation couldn’t be completed. (NSURLErrorDomain error -1011.)

I'm trying to upload an image to a FTP server using swift 4
I used FileProvider which is a library for Ftp connection iOS
anyway I'm checking the provider is reachable. and Im getting this error
The operation couldn’t be completed. (NSURLErrorDomain error -1011.)
this is the full error object:
Error Domain=NSURLErrorDomain Code=-1011 "(null)" UserInfo={NSErrorFailingURLKey=ftp://xxxx.xxxx.xxxx.xxxx:21/, NSErrorFailingURLStringKey=ftp://xxxx.xxxx.xxxx.xxxx:21/, NSURL=ftp://xxxx.xxxx.xxxx.xxxx:21/}
this is my code:
self.ftpProvider!.isReachable { (flag, error) in
if flag {
print("RIZK:--- provider is reachable ")
let progress = self.ftpProvider!.copyItem(localFile: localURL, to: "/files/\(imageName)", overwrite: true, completionHandler: { (error) in
if error == nil {
print("RIZK:-- Ready to upload")
}else{
print("RIZK:--\(error?.localizedDescription ?? "")")
}
})
print(progress?.fractionCompleted ?? 0)
}else{
print("RIZK:--- provider not reachable, with error \(error?.localizedDescription ?? "") ")
}
}

Show share dialog for Facebook Graph Api - iOS

I'm trying to share an object which I've create at the objects tab at the open graph section.
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = message;
gameRequestContent.title = title;
gameRequestContent.recipients = #[#"400098323516165"];
gameRequestContent.actionType = actionType;
gameRequestContent.objectID = #"123456"; //I also tried by the name : bingoclimb:life
FBSDKGameRequestDialog* dialog = [[FBSDKGameRequestDialog alloc] init];
dialog.frictionlessRequestsEnabled = YES;
dialog.content = gameRequestContent;
dialog.delegate = self;
[dialog show];
My objects section looks like this:
If I try with this code (with the id) I get the following error:
Error Domain=com.facebook.sdk.share Code=2 "The operation couldn’t be
completed. (com.facebook.sdk.share error 2.)" UserInfo=0x170c6cdc0
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Sorry, this feature
isn't available right now: An error occurred while processing this
request. Please try again later.}
If I try with the objectId as name I get the following error:
Error Domain=com.facebook.sdk.share Code=100 "The operation couldn’t
be completed. (com.facebook.sdk.share error 100.)"
UserInfo=0x17066eb40
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid fbid.}
Note: the user has publish_actions permission.
Also, when I copy the creation code from the "Sample code for object" and run it I get the following error:
Error Domain=com.facebook.sdk.share Code=201 "The operation couldn’t
be completed. (com.facebook.sdk.share error 201.)"
UserInfo=0x17046a240
{com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Error creating Open
Graph object: Error Domain=com.facebook.sdk.core Code=8 "The operation
couldn’t be completed. (com.facebook.sdk.core error 8.)"
UserInfo=0x1701accc0
{NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter:
0x170016150>, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=1,
NSLocalizedRecoverySuggestion=The server is temporarily busy, please
try again., com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown
error has occurred.,
com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500,
com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=1,
NSLocalizedRecoveryOptions=(
OK ), com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = "BGhIEBfOI+b";
message = "An unknown error has occurred.";
type = OAuthException;
};
};
code = 500; }}, NSUnderlyingError=0x17005abb0 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)"}

issue while Logging-In using Parse

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.

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

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