amazon web services - Getting Crash with AWSS3PutObjectRequest -


i using aws sdk way

properties declaration :

@property (nonatomic, strong)awsstaticcredentialsprovider *credentialsprovider; @property (nonatomic, strong)awsserviceconfiguration * configuration; @property (nonatomic, strong)awss3 *s3; @property (nonatomic, strong) awss3putobjectrequest *putrequest; 

and implementation way

  accesskeys * accesskeys = [ecsglobals sharedinstance].accesskeys;     self.credentialsprovider = [awsstaticcredentialsprovider    credentialswithaccesskey:accesskeys.accesskeyid secretkey:accesskeys.secretaccesskey];     self.configuration = [awsserviceconfiguration configurationwithregion:awsregionuseast1    credentialsprovider:self.credentialsprovider];     self.s3 = [[awss3 alloc] initwithconfiguration:self.configuration];     self.putrequest = [awss3putobjectrequest new];   nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *savedimagepath = [documentsdirectory stringbyappendingpathcomponent:imagename]; nsdata *imagedata = uiimagejpegrepresentation(image, 0.2); [imagedata writetofile:savedimagepath atomically:no];   long long filesize = [[[nsfilemanager defaultmanager] attributesofitematpath:savedimagepath error:nil][nsfilesize] longlongvalue];   self.putrequest.bucket = bucketname; self.putrequest.key = imagename; self.putrequest.contenttype = @"image/jpeg"; self.putrequest.body = [nsurl fileurlwithpath:savedimagepath]; self.putrequest.contentlength =  [nsnumber numberwithlonglong:filesize]; [[self.s3 putobject:self.putrequest] continuewithblock:^id(bftask *task) {     nslog(@"amazon error : %@", [task error]);     return nil; }]; 

but getting crash

[cferror retain]: message sent deallocated instance 0x7f2daff0

i have checked properties strong. not sure why getting crash.

i found solution. getting issue how saved image path become nil before coming in use. there no image data sending aws.

after fixing this, images uploading successfully.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -