解决同时Xcode 10.3(iOS 12.4)和Xcode 11(iOS 13.0)中使用
#ifdef __IPHONE_13_0
if (@available(iOS 13.0, *)) {
if([getMetalDevice() supportsFamily:MTLGPUFamilyApple3])
pixelFormat = MTLPixelFormatBGRA10_XR;
else
#else
{
#endif
pixelFormat = MTLPixelFormatBGRA8Unorm;
}
+ (PHAuthorizationStatus)authorizationStatus {
PHAuthorizationStatus status;
#ifdef __IPHONE_14_0
if (@available(iOS 14, *)) {
status = [PHPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite];
#else
if(NO) {
#endif
}else {
status = [PHPhotoLibrary authorizationStatus];
}
return status;
}
But you should use this code only if you provide some opensource library that support several Xcodes.
If this is part of yours project, you should just migrate to new Xcode and doesn't overcomplicate yours code with preprocessor operators.
Better to solve problems with Appium instead of this.
网友评论