使用 iOS SDK 将图像发布到 S3 存储桶时出现间歇性崩溃错误。
这些崩溃错误由 2 个错误组成,但源自 SDK 的同一区域。
赛格思
0 ofs staff 0x00282616 testflight_backtrace + 382 1 ofs staff 0x00283264 TFSignalHandler + 264 2 libsystem_c.dylib 0x3b656e92 _sigtramp + 42 3 ofs staff 0x001c74a6 -S3Request configureURLRequest (S3Request.m:41) 4 ofs staff 0x001b3c1a -S3AbstractPutRequest configureURLRequest (S3AbstractPutRequest.m:27) 5 ofs staff 0x001c61ee -S3PutObjectRequest configureURLRequest (S3PutObjectRequest.m:62) 6 ofs staff 0x001b2bfe -AmazonS3Client signS3Request: (AmazonS3Client.m:579) 7 ofs staff 0x001b22aa -AmazonS3Client invoke: (AmazonS3Client.m:450) 8 ofs staff 0x001b1298 -AmazonS3Client putObject: (AmazonS3Client.m:134) 9 ofs staff 0x000d511e -OFSAmazonS3Client putObject: (OFSAmazonS3Client.m:41) 10 ofs staff 0x00099b02 -OFSAWSFileUploader upload:forTask:toAWSBucket:accessKey:secret:error: (OFSAWSFileUploader.m:120) 11 ofs staff 0x000d442c -OFSPhotoActivityUploadCell startUpload (OFSPhotoActivityUploadCell.m:104) 12 UIKit 0x354260c4 -UIApplication sendAction:to:from:forEvent: + 72 13 UIKit 0x35426076 -UIApplication sendAction:toTarget:fromSender:forEvent: + 30 14 UIKit 0x35426054 -UIControl sendAction:to:forEvent: + 44 15 UIKit 0x3542590a -UIControl(Internal) _sendActionsForEvents:withEvent: + 502 16 UIKit 0x35425e00 -UIControl touchesEnded:withEvent: + 488 17 UIKit 0x35344420 _UIGestureRecognizerUpdate + 5768 18 CoreFoundation 0x335086cc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20 19 CoreFoundation 0x335069c0 __CFRunLoopDoObservers + 276 20 CoreFoundation 0x33506d16 __CFRunLoopRun + 742 21 CoreFoundation 0x33479ebc CFRunLoopRunSpecific + 356 22 CoreFoundation 0x33479d48 CFRunLoopRunInMode + 104 23 GraphicsServices 0x3703d2ea GSEventRunModal + 74 24 UIKit 0x3538f300 UIApplicationMain + 1120 25 ofs staff 0x00082e36 main (main.m:16) 26 libdyld.dylib 0x3b60fb1f start + 3
-__NSCFNumber requestFormat:无法识别的选择器发送到实例 0x1d43cfc0
0 CoreFoundation 0x335332a3 __exceptionPreprocess + 163 1 libobjc.A.dylib 0x3b1d897f objc_exception_throw + 31 2 CoreFoundation 0x33536e07 -NSObject(NSObject) doesNotRecognizeSelector: + 171 3 CoreFoundation 0x33535531 ___forwarding___ + 393 4 CoreFoundation 0x3348cf68 _CF_forwarding_prep_0 + 24 5 ofs staff 0x001f84a7 -S3Request configureURLRequest (S3Request.m:41) 6 ofs staff 0x001e4c1b -S3AbstractPutRequest configureURLRequest (S3AbstractPutRequest.m:29) 7 ofs staff 0x001f71ef -S3PutObjectRequest configureURLRequest (S3PutObjectRequest.m:64) 8 ofs staff 0x001e3bff -AmazonS3Client signS3Request: (AmazonS3Client.m:579) 9 ofs staff 0x001e32ab -AmazonS3Client invoke: (AmazonS3Client.m:450) 10 ofs staff 0x001e2299 -AmazonS3Client putObject: (AmazonS3Client.m:134) 11 ofs staff 0x0010611f -OFSAmazonS3Client putObject: (OFSAmazonS3Client.m:41) 12 ofs staff 0x000cab03 -OFSAWSFileUploader upload:forTask:toAWSBucket:accessKey:secret:error: (OFSAWSFileUploader.m:120) 13 ofs staff 0x0010542d -OFSPhotoActivityUploadCell startUpload (OFSPhotoActivityUploadCell.m:104) 14 UIKit 0x354260c5 -UIApplication sendAction:to:from:forEvent: + 73 15 UIKit 0x35426077 -UIApplication sendAction:toTarget:fromSender:forEvent: + 31 16 UIKit 0x35426055 -UIControl sendAction:to:forEvent: + 45 17 UIKit 0x3542590b -UIControl(Internal) _sendActionsForEvents:withEvent: + 503 18 UIKit 0x35425e01 -UIControl touchesEnded:withEvent: + 489 19 UIKit 0x35344421 _UIGestureRecognizerUpdate + 5769 20 CoreFoundation 0x335086cd __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21 21 CoreFoundation 0x335069c1 __CFRunLoopDoObservers + 277 22 CoreFoundation 0x33506d17 __CFRunLoopRun + 743 23 CoreFoundation 0x33479ebd CFRunLoopRunSpecific + 357 24 CoreFoundation 0x33479d49 CFRunLoopRunInMode + 105 25 GraphicsServices 0x3703d2eb GSEventRunModal + 75 26 UIKit 0x3538f301 UIApplicationMain + 1121 27 ofs staff 0x000b3e37 main (main.m:16) 28 libdyld.dylib 0x3b60fb20 start + 0
这两个错误都集中在 S3Request.m 的第 41 行,内容如下
[self.urlRequest setValue:self.host forHTTPHeaderField:kHttpHdrHost];
这些错误是间歇性的,到目前为止我无法准确地复制问题,所以不知道当应用程序崩溃时 self.host 的值是多少。
上传成功后,host的值为正确的bucket名称。
为了尝试复制此操作,我尝试在主机名设置为 nil、设置为不正确的存储桶名称、wifi、3G 且没有连接的情况下运行请求,但这些条件都不会导致任何一种情况发生。
有谁知道是什么导致了这些问题,因此我可能需要做些什么来解决这些问题?
===更新===
我终于设法复制它,我不知道如何。我刚拿到SIGSEV。
这是发生错误时 S3Request 对象上请求对象的状态
(S3PutObjectRequest) S3PutObjectRequest = {
S3AbstractPutRequest = {
S3Request = {
AmazonServiceRequest = {
NSObject = {
isa = OFSS3PutObjectRequest
}
httpMethod = 0x004bde08 @"GET"
parameters = 0x00000000
endpoint = 0x004c3a38 @"https://s3.amazonaws.com"
userAgent = 0x1d427b60 @"aws-sdk-iOS/1.4.4 iPhone-OS/6.0.1 en_GB"
credentials = 0x00000000
urlRequest = 0x1d1165f0
urlConnection = 0x1d04d680
responseTimer = 0x00000000
requestTag = 0x00000000
serviceName = 0x00000000
regionName = 0x00000000
hostName = 0x00000000
delegate = 0x1c567ba0
}
authorization = 0x00000000
contentLength = 0
contentType = 0x004b9e28 @"image/jpeg"
date = 0x1d0e8340 <not an Objective-C object>
securityToken = 0x00000000
bucket = 0x1d4464f0 @"*****"
key = 0x1d1eb040 @"id_C78ACBEA_58163_0.jpg"
subResource = 0x00000000
}
cannedACL = 0x00000000
fullACL = 0x00000000
storageClass = 0x00000000
serverSideEncryption = 0x00000000
metadata = 0x1d2d6700 0 key/value pairs
}
expiresSet = NO
cacheControl = 0x00000000
contentDisposition = 0x00000000
contentEncoding = 0x00000000
contentMD5 = 0x00000000
filename = 0x00000000
data = 0x1d1a9f00 3814479 bytes
stream = 0x00000000
expect = 0x00000000
generateMD5 = NO
expires = 0
redirectLocation = 0x00000000
}