[React-Native]Workaround for Xcode 12 Linking Errors
Lost React.framework reference for some Frameworks which depends on React.framework.
Add to the end of Podfile
post_install do |installer|
puts("### Workaround for Xcode 12 and Auto-Linking")
installer.pods_project.targets.each do |target|
if ['RNCAsyncStorage', 'RNVectorIcons', 'RNLocalize', 'React-RCTText', 'react-native-mapbox-gl', 'RNPermissions', 'RNReanimated', 'RNScreens', 'RNShare', 'react-native-netinfo', 'RNSVG', 'RNCisco', 'RNCiscoContribution', 'RNCiscoNotification', 'react-native-camera', 'react-native-safe-area-context', 'react-native-segmented-control', 'RNCPicker'].include?(target.name) #list all affected target in the array
target.build_phases.each do |build_phases|
if build_phases.display_name == 'Frameworks'
file_ref = installer.pods_project.new(Xcodeproj::Project::Object::PBXFileReference)
file_ref.path = 'React.framework'
file_ref.source_tree = 'BUILT_PRODUCTS_DIR'
build_phases.add_file_reference(file_ref)
puts("### #{target.name} ==> Adding React.framework reference")
end
end
end
end
end
Bonjour service not working on iOS 14
Root Cause: Should add support for local network privacy permissions in iOS 14
https://developer.apple.com/forums/thread/653316
https://developer.apple.com/videos/play/wwdc2020/10110/
Fix: Add permissions to plist
<key>NSLocalNetworkUsageDescription</key>
<string>Looking for local devices with tcp Bonjour services</string>
<key>NSBonjourServices</key>
<array>
<string>_YOUR_LOCAL_SERVICE._tcp</string>
</array>
[React-Native]图片在iOS14无法显示
https://github.com/facebook/react-native/issues/29279#issuecomment-699587944
// RCTUIImageViewAnimated+Patch.h
#import <Foundation/Foundation.h>
#import <React/RCTViewManager.h>
#import <React/RCTUIImageViewAnimated.h>
NS_ASSUME_NONNULL_BEGIN
@interface RCTUIImageViewAnimated (Patch)
@end
NS_ASSUME_NONNULL_END
#import "RCTUIImageViewAnimated+Patch.h"
#import <objc/runtime.h>
@implementation RCTUIImageViewAnimated (Patch)
+(void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Method fromMethod = class_getInstanceMethod([self class], @selector(displayLayer:));
Method toMethod = class_getInstanceMethod([self class], @selector(patch_displayLayer:));
method_exchangeImplementations(fromMethod, toMethod);
});
}
// RCTUIImageViewAnimated+Patch.m
- (void)patch_displayLayer:(CALayer *)layer {
UIImage *currentFrame = [self valueForKey:@"currentFrame"];
CGFloat animatedImageScale = [[self valueForKey:@"animatedImageScale"] floatValue];
if (currentFrame) {
layer.contentsScale = animatedImageScale;
layer.contents = (__bridge id)currentFrame.CGImage;
} else {
[super displayLayer:layer];
}
}
@end
网友评论