react-native-xupdate icon indicating copy to clipboard operation
react-native-xupdate copied to clipboard

ios如何添加更新

Open wangweiruning opened this issue 4 years ago • 5 comments

请问一下大佬ios如何添加更新

wangweiruning avatar Mar 24 '20 10:03 wangweiruning

导入之后,我这边iOS会编译报错

hdi1szh avatar Apr 09 '20 02:04 hdi1szh

pod install 报错 No podspec found for RNXUpdate in ../node_modules/react-native-xupdate-new

alex521 avatar Jun 12 '20 09:06 alex521

pod install 报错 No podspec found for RNXUpdate in ../node_modules/react-native-xupdate-new

这个框架目前只支持android,我的解决办法是把RNXUpdate.podspec里的s.homepage修改成"https://github.com/author/RNXUpdate";然后自己在iOS原生定义RNXUpdate类处理iOS的升级

hdi1szh avatar Jun 12 '20 09:06 hdi1szh

pod install 报错 No podspec found for RNXUpdate in ../node_modules/react-native-xupdate-new

这个框架目前只支持android,我的解决办法是把RNXUpdate.podspec里的s.homepage修改成"https://github.com/author/RNXUpdate";然后自己在iOS原生定义RNXUpdate类处理iOS的升级

改了s.homepage后,pod install 不报错了,但是运行ios项目时会报错,说native module can not be null , 这个ios项目怎么做处理? 其实我只想把这个包用在android上, ios下自己用js检查版本,跳转到市场就可以了

alex521 avatar Jun 19 '20 07:06 alex521

Q1. pod install 报错

No podspec found for RNXUpdate in ../node_modules/react-native-xupdate-new

一种解决办法是手动修改../node_modules/react-native-xupdate-new中podspec文件内的s.homepage,使其不为空值。这么做能临时解决问题,但不完美。

第二种解决方法是 使其在ios环境下不自动链接 xupdate,完美解决pod install的报错。(推荐做法) 做法: 在工程根目录下添加react-native.config.js 文件内容为

// react-native.config.js
module.exports = {
  dependencies: {
    'react-native-xupdate-new': {
      platforms: {
       ios: null, // disable ios platform, because the lack of homepage in podspec file
      },
    },
  },
};

How can I disable autolinking for unsupported library?

Q2

有些人在运行ios项目时会报错,说native module can not be null , 不晓得这个 ios项目怎么做处理? 其实只想把这个包用在android上, ios下自己用js检查版本,跳转到市场就可以了

解决办法是ios和android分别使用不同的js文件。

React Native 会检测某个文件是否具有.ios.或是.android.的扩展名,然后根据当前运行的平台自动加载正确对应的文件。

比如你可以在项目中创建下面这样的组件:

BigButton.ios.js BigButton.android.js

然后去掉平台扩展名直接引用:

import BigButton from './BigButton';

RN 文档

nozbwang avatar Oct 12 '20 06:10 nozbwang