Skip to content

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

Description

@TQCasey

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 + "/"; // 默认缺了一个 / 符号,加上

改动后,一切正常了

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions