Block format?!?!?!

I'm having trouble upgrading my block to iOS 13 and I cannot find an example anywhere on the web. What am I missing here?


[[PHImageManager defaultManager] requestImageDataAndOrientationForAsset:tempAsset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info){
            
            }];

Gives me an error of: Incompatible block pointer types sending 'void (^)(NSData * _Nullable __strong, NSString * _Nullable __strong, UIImageOrientation, NSDictionary * _Nullable __strong)' to parameter of type 'void (^ _Nonnull)(NSData * _Nullable __strong, NSString * _Nullable __strong, CGImagePropertyOrientation, NSDictionary * _Nullable __strong)'



Thank you!

The problem is with the type of the orientation parameter of your block. Your block is using UIImageOrientation as the type, but the method you're passing it to is expecting a block that uses CGImagePropertyOrientation for that parameter.


These two types are not interchangeable. So, you're going to have to change the code within the block, too. See the discussion in Apple's docs here.

Block format?!?!?!
 
 
Q