ReactNativeios常见错误和解决⽅法
常规错误问题
CFBundleIdentifier", Does Not Exist
这个问题不存在的, 说什么包不完整都是扯. 直接在xcode ⾥⾯运⾏调试. 错误.⼀步⼀步解决,其他错误解决了. 这个问题也就不存在了warning: directory not found for option
⽬录⽂件缺失,
npm install , pod install , react-native link
如果还是不⾏,在Build Settings=> Library Search Paths => 到这个路径⼲掉即可
‘React/RCTEventDispatcher.h’ file not found
‘React/RCTViewManager.h’ file not found
‘React/RCTView.h’ file not found
React 没有编译 造成的.选中项⽬, 点击项⽬(就是那个⽅形的Stop图标右边) =>Edit Sechme => Build
取消勾选Parallelize Build
在Tagets 点下⾯那个加号 ,加⼊React(房⼦图标),然后把他拖到第⼀,点Close
或者先编译React
或者是 Pod ⾥⾯React 冲突 ,把 pod ⾥⾯react 开头的 依赖 ⼲掉, 改为⼿动依赖. 然后 rm -rf Pods && pod install
unable to open file in target xcode 10 10.1
In File-> Workspace setting -> select Legasy Build System
1. pod repo remove master
2. pod setup
3. pod install .
module map file ‘/Users/chuchur/Projects/…/ios/Pods/Headers/Public/dulemap’ not fo
und
这个问题是依赖版本升级之后和⽼的版本冲突,导致编译不完整
rm -rf Pods && pod install
React Native ‘config.h’ file not found
cd node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh
library not found for -lstdc++.6
This error is caused by a @providesModule declaration with the same name across two different files.
jest-haste-map: @providesModule naming collision
This error is caused by hasteImpl returning the same name for different files.
以下github 的解答 , 但是问题依旧.
新建 fig.js
const blacklist =require('metro-config/src/defaults/blacklist');
resolver:{
blacklistRE:blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
};
1. Clear watchman watches: watchman watch-del-all.
2. Delete the node_modules folder: rm -rf node_modules && npm install.
3. Reset Metro Bundler cache: rm -rf $TMPDIR/metro-bundler-cache-* or npm start -- --reset-cache.
4. Remove haste cache: rm -rf $TMPDIR/haste-map-react-native-packager-*.
把 pod ⾥⾯react 开头的 依赖 ⼲掉, 改为⼿动的. 然后 rm -rf Pods && pod install
Unable to resolve module react-navigation/src/views/CardStack/CardStackStyleInterpolator from /Users/chuchur/Projects/.../Scence/index.js: Module react-
navigation/src/views/CardStack/CardStackStyleInterpolator does not exist in the Haste module map react-navigation 升级版本之后出现的问题
import CardStackStyleInterpolator from'react-navigation/src/views/CardStack/CardStackStyleInterpolator';
//改为
import StackViewStyleInterpolator from'react-navigation-stack/dist/views/StackView/StackViewStyleInterpolator';
symbol(s) not found for architecture x86_64
Undefined symbols for architecture x86_64:
“_OPENSSL_ia32cap_P”, referenced from:
_EVP_aes_128_cbc_hmac_sha1 in ***(e_aes_cbc_hmac_sha1.o)
_EVP_aes_256_cbc_hmac_sha1 in ***(e_aes_cbc_hmac_sha1.o)
_aesni_cbc_hmac_sha1_ctrl in ***(e_aes_cbc_hmac_sha1.o)
_EVP_aes_128_cbc_hmac_sha256 in ***(e_aes_cbc_hmac_sha256.o)
_EVP_aes_256_cbc_hmac_sha256 in ***(e_aes_cbc_hmac_sha256.o)
_aesni_cbc_hmac_sha256_cipher in ***(e_aes_cbc_hmac_sha256.o)
_aesni_cbc_hmac_sha256_ctrl in ***(e_aes_cbc_hmac_sha256.o)
…
ld: symbol(s) not found for architecture x86_64
依赖组件不⽀持32 或者 64位平台. 模拟器好好的 , 真实机就出问题.
建议看看依赖组件的正确使⽤姿势.
property has a previous declaration
Pod ⾥⾯和 General => Linked Frameworks and Libraries ⾥⾯重复依赖. ⼲掉⼀个即可
reactnative开发或者你⽂件⾥重复定义了
635 duplicate symbols for architecture x86_64 … duplicate symbol _x509parse_verify in:
删除 /Users/⽤户名字/Library/Developer/Xcode/DerivedData/ ⾥⾯的所有
Failed to create provisioning profile.
链接测试机即可.
修改bundle identifier 标识符即可, 你的⼿机可能已经安装了⼀个这样的包,(连接上⼿机)
‘RNSVGLinearGradient’ was not found in the UIManager
装⼀下 react-native-svg 这个库, 然后⼿动添加⼀下依赖就可以了
No account for team “QMP96B5DPW”. Add a new account in the Accounts preference pane or verify that your accounts have valid credentials.
原因:项⽬中的teamID未修改。到修改即可
Development cannot be enabled while your device is locked.
解决⽅法是:打开⼿机设置->通⽤->还原->还原位置与隐私;
然后会有弹窗提⽰你是否信任此电脑,点击信任,重启Xcode之后,运⾏项⽬到⼿机上
Could not launch,has denied the launch request.
先⼲掉⼿机⾥⾯已经安装的app,断开连线.关掉Xcode
mac打开钥匙串 => 底下的种类=> 证书 到Apple Worldwide Developer Relations Certication Authority
使⽤此证书时: 使⽤系统默认. => 保存
其他
⼿动添加依赖
Xcode打开项⽬, Libraries右键 Add Files to “Your Project Name” 在node_modules/…/到 .xcodeproj
Project -> Build Phases -> Link Binary With Libraries 加⼊ Add libBVLinearGradient.a
Libraries => 点击 .xcodeproj =>Build Settings=> Header Search Paths=> 加⼊ $(SRCROOT)/…/react-native/React
更改模拟器
react-native run-ios --simulator "iPhone 7 Plus"
注意事项
执⾏ react-native link 之后,部分组件 会⾃动关联 和修改 Podfile⽂件
⽐如给你⾃动加上
...
pod 'react-native-webview',:path =>'../node_modules/react-native-webview'
然后当你执⾏pod install 会造成各种问题. 执⾏之后 请使⽤Xcode打开 *.xcworkspace
出现问题请使⽤xcode 编译调试错误.
开发者的相关问题
Your development team, “”, does not support the Push Notifications capability.
No profiles for ‘jaadee.JadeKing’ were found
does not support the Associated Domains and Push Notifications capabilities.
1.到⼯程⽂件中itlements⽂件
2.删除.entitlements⽂件中的aps-environment,运⾏即可。
Failed to create provisioning profile.
Project=>General=> Bundle Identifier 改个名字即可
快速定位错误
Thread 1: signal SIGABRT
点击左边项⽬导航栏顶部⼯具栏中倒数第⼆个按钮,就是(就是横着像个标签的图标)
然后点左下⾓的+号,添加⼀个异常断点"Add exception breakpoint…"
然后重新运⾏⼀下,ide会帮你定位到错误的⾏
编译打包ios
在package.json中添加编译命令
{
"scripts":{
"bundle-ios":"node node_modules/react-native/local-cli/cli.js bundle --entry-file index.js --platform ios --dev false --bundle-output ./ios/bundle/index.ios .jsbundle --assets-dest ./ios/bundle"
}
}
--entry-file ,ios或者android⼊⼝的js名称,⽐如index.js
--platform ,平台名称(ios或者android)
--dev ,设置为false的时候将会对JavaScript代码进⾏优化处理。
--bundle-output,⽣成的jsbundle⽂件的名称,⽐如./ios/bundle/index.ios.jsbundle
--assets-dest 图⽚以及其他资源存放的⽬录,⽐如./ios/bundle
1) Xcode => Add Files to "RNIos"=>选择bundle⽂件,在option中选择Create folder references
2)设置AppDelegate.m⽂件
NSURL*jsCodeLocation;
#ifdef DEBUG
//开发包
jsCodeLocation =[[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
#else
//离线包
jsCodeLocation =[[NSBundle mainBundle] URLForResource:@"bundle/index.ios" withExtension:@"jsbundle"];
#endif
本⽂将持续更新…
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论