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

iOS 热更后找不到主bundle的图片

Open TQCasey opened this issue 5 years ago • 0 comments

Hi,IOS 热更后,现象如题

环境 ios 12.4.3
iphone 6plus react native 0.61.5

初始化 `import {AppRegistry} from 'react-native'; import App from './App'; import {name as appName} from './app.json';

import {SmartAssets} from 'react-native-smartassets'; SmartAssets.initSmartAssets();

AppRegistry.registerComponent(appName, () => App);`

测试后发现 android 能正常显示,ios 则不能,没有找到合适的调试方法,就直接alert,最后发现 是路径拼接的有问题 ,我自己改了下,改好了, 改的地方如下

const defaultMainBundePath = Smartassets.DefaultMainBundlePath; // 原来被注释掉了,加回来 ... ... let oriJsBundleUrl = 'file://'+defaultMainBundePath+'/'+iOSRelateMainBundlePath + "/"; // 默认缺了一个 / 符号,加上

改动后,一切正常了

看下是不是还有更合适的方法

TQCasey avatar Oct 26 '20 07:10 TQCasey