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

ios如何添加更新 #2

Open
wangweiruning opened this issue Mar 24, 2020 · 5 comments
Open

ios如何添加更新 #2

wangweiruning opened this issue Mar 24, 2020 · 5 comments

Comments

@wangweiruning
Copy link

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

@hdi1szh
Copy link

hdi1szh commented Apr 9, 2020

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

@alex521
Copy link

alex521 commented Jun 12, 2020

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

@hdi1szh
Copy link

hdi1szh commented Jun 12, 2020

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的升级

@alex521
Copy link

alex521 commented Jun 19, 2020

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检查版本,跳转到市场就可以了

@nozbwang
Copy link

nozbwang commented Oct 12, 2020

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 文档

h1u2i3 added a commit to aman-io/react-native-xupdate that referenced this issue Jan 1, 2023
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

4 participants