看起来您正在使用带有 Grand Central Dispatch 的 AWS 开发工具包,并getObject:
在同一个线程上调用同步和更新 UI。您需要确保调用getObject:
后台线程,并在主线程上更新 UI。您的代码应如下所示:
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for(int i=0;i<ads.count;i++){
NSString *phot =[ads objectAtIndex:i];
NSLog(@"hna%@",phot);
S3GetObjectRequest *getObjectRequest = [[S3GetObjectRequest alloc] initWithKey:phot withBucket:@"olfactifPhoto"];
S3GetObjectResponse *getObjectResponse = [[AmazonClientManager s3] getObject:getObjectRequest];
dispatch_async( dispatch_get_main_queue(), ^{
UIImage *tampon = [[UIImage alloc] initWithData:getObjectResponse.body];
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:tampon];
tempImageView.frame = CGRectMake(10,currentXLocation, 300, 310);
NSLog(@" il est dans la position %f",tempImageView.frame.origin.y);
self.monImage = tempImageView;
[scroll addSubview:monImage];
});
}
});