Xcode 12 & iOS 14 兼容性問題

[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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末攀痊,一起剝皮案震驚了整個濱河市袜啃,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌昔案,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,104評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件锌介,死亡現(xiàn)場離奇詭異亮元,居然都是意外死亡,警方通過查閱死者的電腦和手機史隆,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,816評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來曼验,“玉大人泌射,你說我怎么就攤上這事△拚眨” “怎么了熔酷?”我有些...
    開封第一講書人閱讀 168,697評論 0 360
  • 文/不壞的土叔 我叫張陵,是天一觀的道長豺裆。 經(jīng)常有香客問我拒秘,道長,這世上最難降的妖魔是什么留储? 我笑而不...
    開封第一講書人閱讀 59,836評論 1 298
  • 正文 為了忘掉前任翼抠,我火速辦了婚禮,結(jié)果婚禮上获讳,老公的妹妹穿的比我還像新娘阴颖。我一直安慰自己,他們只是感情好丐膝,可當我...
    茶點故事閱讀 68,851評論 6 397
  • 文/花漫 我一把揭開白布量愧。 她就那樣靜靜地躺著钾菊,像睡著了一般。 火紅的嫁衣襯著肌膚如雪偎肃。 梳的紋絲不亂的頭發(fā)上煞烫,一...
    開封第一講書人閱讀 52,441評論 1 310
  • 那天,我揣著相機與錄音累颂,去河邊找鬼滞详。 笑死,一個胖子當著我的面吹牛紊馏,可吹牛的內(nèi)容都是我干的料饥。 我是一名探鬼主播,決...
    沈念sama閱讀 40,992評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼朱监,長吁一口氣:“原來是場噩夢啊……” “哼岸啡!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起赫编,我...
    開封第一講書人閱讀 39,899評論 0 276
  • 序言:老撾萬榮一對情侶失蹤巡蘸,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后擂送,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體悦荒,經(jīng)...
    沈念sama閱讀 46,457評論 1 318
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,529評論 3 341
  • 正文 我和宋清朗相戀三年嘹吨,在試婚紗的時候發(fā)現(xiàn)自己被綠了逾冬。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,664評論 1 352
  • 序言:一個原本活蹦亂跳的男人離奇死亡躺苦,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出产还,到底是詐尸還是另有隱情匹厘,我是刑警寧澤,帶...
    沈念sama閱讀 36,346評論 5 350
  • 正文 年R本政府宣布脐区,位于F島的核電站愈诚,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏牛隅。R本人自食惡果不足惜炕柔,卻給世界環(huán)境...
    茶點故事閱讀 42,025評論 3 334
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望媒佣。 院中可真熱鬧匕累,春花似錦、人聲如沸默伍。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,511評論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至炼蹦,卻和暖如春羡宙,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背掐隐。 一陣腳步聲響...
    開封第一講書人閱讀 33,611評論 1 272
  • 我被黑心中介騙來泰國打工狗热, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人虑省。 一個月前我還...
    沈念sama閱讀 49,081評論 3 377
  • 正文 我出身青樓匿刮,卻偏偏與公主長得像,于是被迫代替她去往敵國和親慷妙。 傳聞我的和親對象是個殘疾皇子僻焚,可洞房花燭夜當晚...
    茶點故事閱讀 45,675評論 2 359