Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native #1

Open
chooin opened this issue Dec 15, 2020 · 8 comments
Open

React Native #1

chooin opened this issue Dec 15, 2020 · 8 comments

Comments

@chooin
Copy link
Owner

chooin commented Dec 15, 2020

Android

  1. 无法抓包问题
  2. 日志捕捉,安装 brew install pidcat
pidcat [bundle id] 
  1. 无法安装,有相同的 bundle id 包已在本地安装
  2. Android 仅支持 Java 8
# .zshrc
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib
  1. 部分手机 web-view 使用 canvas 后闪退,给 web-view 添加样式 opacity: 0.99 即可,参考文档
  2. 清空 Gradle 缓存 cd android && ./gradlew clean
@chooin
Copy link
Owner Author

chooin commented Dec 18, 2020

iOS

  1. 新增 iOS target 后需要更新 Podfile 文件
  2. 推送问题:
  • Capability 必须添加 Push Notifications
  • 打包后才能调试推送
  1. 命令行无法安装 APP 到手机,重新执行 yarn,然后试试 XCode 直接安装

@chooin
Copy link
Owner Author

chooin commented Dec 18, 2020

fastlane

  1. fastlane 目录下的 Gemfile.lock 文件最好不要提交到仓库,不然会锁住打包机 fastlane 版本
  2. 在 fastlane 目录下执行 fastlane android beta
  3. 一直卡在 Fetching rake,执行 bundle installsudo bundle install
  4. fastlane 升级 sudo gem install fastlane,升级完成后务必在 fastlane 目录下执行 bundle install

@chooin
Copy link
Owner Author

chooin commented Dec 21, 2020

react-native-webview

  1. window.document.addEventListener 不等于 document.addEventListener,建议:
# iOS
window.addEventListener('message', () => {})

# Android
window.document.addEventListener('message', () => {})
  1. JSBridge 实现(callback 和 promise),参考文档

@chooin
Copy link
Owner Author

chooin commented Dec 21, 2020

Pod

  1. 更新源
# 更新所有源
pod repo update --verbose

# 只更新某个源
pod repo update aliyun --verbose && pod update --verbose --no-repo-update

# 更新项目的 Pod
pod update --verbose
  1. Podfile 文件注释不能随便写,随便写可能会把注释信息当成 Pod 安装
  2. Pod 更新后需要重新打包 App
  3. 已安装 Pod 但还是无法使用,尝试清空 Pod
# 找到对应的 Pod 删除掉
~/.cocoapods/repos
# 找到对应的 Pod 删除掉
~/Library/Caches/CocoaPods/Pods/Release
# 找到对应的 Pod 删除掉
~/Library/Caches/CocoaPods/Pods/Specs
# 删除当前项目的 Pods 目录
ios/Pods

@chooin
Copy link
Owner Author

chooin commented Dec 22, 2020

Metro

  1. metro 只更新 jsbundle,安装新的 npm 包无需重新执行 yarn start

@chooin
Copy link
Owner Author

chooin commented Dec 25, 2020

react-native-permissions

权限检查尽量使用 react-native-permissions 而不是模块自带权限检查,不然有可能产生空指针异常。

@chooin
Copy link
Owner Author

chooin commented Feb 26, 2021

React Native 版本升级

  1. Android 需同时升级下本地 gradle 版本

@chooin
Copy link
Owner Author

chooin commented Jun 8, 2021

无法验证 iphone distribution

问题原因:部分区域电信运营商的网络无法连接到苹果服务器

解决方案:切换网络,如,wifi,电信的可以切换到移动、联通

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant