HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iOS Amazon S3 SDK:发送到解除分配的实例的消息大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到以下错误

*** -[S3PutObjectOperation_Internal respondsToSELEctor:]: message sent to deallocated instance 0x43c18fd0

我不太了解Zombies检查员的堆栈跟踪,我不确定这是否告诉我任何我可以解决的问题:

#   Address Category    Event Type  RefCt   timestamp   Size    Responsible Library Responsible Caller
0   0xc071f60   S3PutObjectOperation_Internal   Malloc  1   00:14.903.021   48  MyApp   -[S3TransfeRMANager upload:]
1   0xc071f60   S3PutObjectOperation_Internal   Retain  2   00:14.903.032   0   Foundation  ____addoperations_block_invoke_0
2   0xc071f60   S3PutObjectOperation_Internal   Release 1   00:14.903.036   0   MyApp   -[S3TransfeRMANager upload:]
3   0xc071f60   S3PutObjectOperation_Internal   Retain  2   00:14.904.154   0   libsystem_sim_blocks.dylib  _Block_object_assign
4   0xc071f60   S3PutObjectOperation_Internal   Retain  3   00:14.904.163   0   libsystem_sim_blocks.dylib  _Block_object_assign
5   0xc071f60   S3PutObjectOperation_Internal   Release 2   00:14.904.164   0   Foundation  __destroy_Helper_block_474
6   0xc071f60   S3PutObjectOperation_Internal   Retain  3   00:14.906.549   0   MyApp   -[S3PutObjectOperation_Internal start]
7   0xc071f60   S3PutObjectOperation_Internal   Release 2   00:14.906.554   0   MyApp   -[S3PutObjectOperation_Internal start]
8   0xc071f60   S3PutObjectOperation_Internal   Release 1   00:14.907.624   0   MyApp   __destroy_Helper_block_
9   0xc071f60   S3PutObjectOperation_Internal   Retain  2   00:15.243.299   0   MyApp   -[S3PutObjectOperation_Internal finish]
10  0xc071f60   S3PutObjectOperation_Internal   Retain  3   00:15.243.302   0   MyApp   -[S3PutObjectOperation_Internal finish]
11  0xc071f60   S3PutObjectOperation_Internal   Release 2   00:15.243.307   0   MyApp   -[S3PutObjectOperation_Internal finish]
12  0xc071f60   S3PutObjectOperation_Internal   Release 1   00:15.243.330   0   MyApp   -[S3PutObjectOperation_Internal finish]
13  0xc071f60   S3PutObjectOperation_Internal   Release 0   00:15.244.420   0   Foundation  __release_object_op
14  0xc071f60   S3PutObjectOperation_Internal   Zombie  -1  00:15.386.107   0   MyApp   -[S3Response connection:didSendBodyData:@R_702_10586@lBytesWritten:@R_702_10586@lBytesExpectedToWrite:]

应用程序上传照片时会发生错误. Photo对象使用并实现以下方法

-(void)request:(Amazonservicerequest *)request didSendData:(NSInteger)bytesWritten @R_702_10586@lBytesWritten:(NSInteger)@R_702_10586@lBytesWritten @R_702_10586@lBytesExpectedToWrite:(NSInteger)@R_702_10586@lBytesExpectedToWrite
{
  NSLog(@"didSendData called: %d - %d / %d",bytesWritten,@R_702_10586@lBytesWritten,@R_702_10586@lBytesExpectedToWritE);
  self.transferProgress += bytesWritten;
  float p = (float) self.transferProgress / self.uploadSize;
  self.uploadProgress = [NS@R_450_10793@er @R_450_10793@erWithFloat:p];
}

-(void)request:(Amazonservicerequest *)request didCompleteWithResponse:(AmazonserviceResponse *)response
{
  NSLog(@"didCompleteWithResponse called.");
}

-(void)request:(Amazonservicerequest *)request didFailWithError:(NSError *)error
{
  NSLog(@"didFailWithError called: %@",error);
}

据我所知,这是应用程序中唯一一个S3请求与任何其他对象/实例通信的点.知道是什么导致了这个错误吗?

解决方法

我认为这是AWS SDK中的一个错误.我不确定错误的确切位置,但是如果响应是服务异常(并且可能只与S3TransfeRMANager结合使用),它会被请求重试触发.

我不想禁用所有重试,所以我通过强制不重试服务异常来修复此问题.您可以使用AmazonS3Client的子类来覆盖一个方法,如下所示:

- (BOOL)shouldRetry:(AmazonserviceResponse *)response exception:(NSException *)exception
{
    // There is some kind of bug that is triggered on request retries when S3 requests
    // return an explicit service exception (e.g.,auth token expired). In these cases
    // we force no retry to avoid the bug.
    NSException *exceptionHolder = response.exception;
    if(exceptionHolder == nil)
    {
        exceptionHolder = exception;
    }

    if([exceptionHolder isKindOfClass:[AmazonserviceException class]])
    {
        return NO;
    }

    return [super shouldRetry:response exception:exception];
}

大佬总结

以上是大佬教程为你收集整理的iOS Amazon S3 SDK:发送到解除分配的实例的消息全部内容,希望文章能够帮你解决iOS Amazon S3 SDK:发送到解除分配的实例的消息所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。