React Native在release的過程中县习,總是會遇到一些奇怪的問題
xcode 9.3進(jìn)行release的過程中遣臼,經(jīng)常會出現(xiàn)這個問題
Build fails.
/Users/*****/node_modules/react-native/Libraries/Text/RCTTextField.m:131:108: Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
RCTLogWarn(@"Native TextInput(%@) is %zd events ahead of JS - try to make your JS faster.", self.text, eventLag);
Enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
同時在RCTImage和RCTImageCache中都會出現(xiàn)相同的問題硼一。
解決這個問題有兩種途徑纱耻,一個是把xcode降級到9.2提揍,另一種則是把%zd
改成lld
并在eventLag
的前面加上 (long long )塘偎。
最近手賤將xcode升級到10项栏,然后在一開始builddebug版本時并沒有太多問題女蜈,但是在release的時候碰到了一下問題
? Compiling vlog_is_on.cc
? /Users/guillaumehain/Developments/companion/node_modules/react-native/third-party/glog-0.3.4/src/base/mutex.h:105:10: 'config.h' file not found
#include "config.h" // to figure out pthreads support
^
為了解決這個問題澜共,在查閱了github后進(jìn)行了如下操作
$ cd node_modules/react-native/third-party/glog-0.3.4/ && ./configure
然后又出現(xiàn)了下面這個問題
[10:41:27]: ? Compiling signalhandler.cc
[10:41:27]: ? ? /Users/guillaumehain/Developments/companion/node_modules/react-native/third-party/glog-0.3.4/src/signalhandler.cc:78:28: no member named '__rip' in '__darwin_arm_thread_state'
[10:41:27]: ? return (void*)context->PC_FROM_UCONTEXT;
[10:41:27]: ?
大晚上的差點(diǎn)氣的摔了電腦怜跑,想想算了样勃,畢竟自己手賤升級的,
又查閱了github之后性芬,發(fā)現(xiàn)可以把(void*)context->PC_FROM_UCONTEXT
改成 NULL
即改成下面這個樣子
return (void*)context->PC_FROM_UCONTEXT;
== >
return NULL;
這樣就可以進(jìn)行release版本了峡眶,暫時為什么會出現(xiàn)這些問題,以及這樣做有什么問題并不清楚植锉,等之后有時間了再深究一下辫樱。
慎重升級啊?”印Jㄊ睢!辉饱!
2018-12-26日更新
之前的時候發(fā)現(xiàn)了一種新的方法搬男,可以很好的解決這個問題
在xcode 點(diǎn)擊 file- workspace Settings
屏幕快照 2018-12-26 上午11.17.43.png
然后把里面的Build System 改為 Legacy Build System
如下圖所示
更改前
更改后
可以build之前運(yùn)行 rm -rf node_modules && yarn cache clean && yarn
再進(jìn)行build。