Amazon s3バケットに画像をアップロードしています。別のクラスAmazons3にコードを書いています。クラスメソッドでアクセスされるエラーインスタンス変数s3を取得しています。このエラーを解決する方法.im変数の初期化用のコンストラクターを作成しています。手伝ってください。
-(id) init
{
self = [super init];
if(self)
{
if(self.s3 == nil)
{
// Initial the S3 Client.
self.s3 = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY];
}
}
return self;
}
+(void)uploadImage:(Products *)product
{
NSData *uploadData = [NSData dataWithContentsOfFile:[Util getFilePathForFileName:[NSString stringWithFormat:@"%@ios.mp4",product.productImageUrl]]];
S3PutObjectRequest *por = [[S3PutObjectRequest alloc] initWithKey:[NSString stringWithFormat:@"%@.mp4",product.productImageUrl] inBucket:BUCKET_NAME];
por.contentType = @"application/octet-stream";
por.cannedACL = [S3CannedACL publicRead];
por.data = uploadData;
S3PutObjectResponse *putObjectResponse = [s3 putObject:por];
if(putObjectResponse.error !=nil)
[self performSelectorOnMainThread:@selector(showCheckErrorMessage:) withObject:putObjectResponse.error waitUntilDone:NO];
}