ios 5 AWS SDK S3PutObjectRequest

时间:2011-10-23 07:47:23

标签: amazon-s3 amazon-web-services ios5

我刚刚将我的应用更新为ios5,下面的代码(工作在4x中)现在无效 我认为这是因为UUID,但我改变了,错误保持不变。我得到的错误如下。非常感谢任何帮助 - thx

我设置了一些断点并隔离了错误,我认为错误是使用localPutObjectRequest,但在查看该行后,错误消息对我没有意义。

- (void) updateLocation:(CLLocation*)loc
{
    [progressView setProgress:5];
    [[LocationManager sharedLocationManager] setDelegate:nil];

    uploadPath = [NSString stringWithFormat:@"%@/%@-%f.png", [[UIDevice currentDevice] uniqueIdentifier], [[UIDevice currentDevice] uniqueIdentifier], [[NSDate date] timeIntervalSince1970]];

    S3PutObjectRequest *localPutObjectRequest = [[[S3PutObjectRequest alloc] initWithKey:uploadPath inBucket:[NSString stringWithFormat:@"spotted-at"]] autorelease];


    localPutObjectRequest.data = UIImagePNGRepresentation([UIImage imageWithData:imageData]);
    [localPutObjectRequest setDelegate:self];

    [[Constants s3] putObject:localPutObjectRequest];

}



2011-10-23 00:45:39.654 spotted.at[4131:707] -[UIButtonContent length]: unrecognized   selector sent to instance 0x2c0130
2011-10-23 00:45:39.656 spotted.at[4131:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButtonContent length]: unrecognized  selector sent to instance 0x2c0130'
*** First throw call stack:
(0x310868bf 0x3822b1e5 0x31089acb 0x31088945 0x30fe3680 0x330e42ef 0x330e4267 0x331d7e51    0x49041 0x4973d 0x352c05df 0x352bff81 0x352ba62f 0x3105ab31 0x3105a15f 0x31059381 0x30fdc4dd 0x30fdc3a5 0x33c0afed 0x3304e743 0x453b 0x3f74)

1 个答案:

答案 0 :(得分:-1)

从您的帖子判断,错误在于

[[UIDevice currentDevice] uniqueIdentifier]

UIDevice uniqueIdentifier方法在iOS 5中已弃用,不应调用。从你的代码我真的不知道你究竟想要做什么,但这篇文章 UIDevice uniqueIdentifier Deprecated - What To Do Now?

应该有助于克服弃用的方法。您应该更改已弃用的呼叫,并使用上面帖子中列出的呼叫。这应该可以解决问题。