简体   繁体   English

在为发行版进行编译时,如何让React Native将JS捆绑包放入Share Extension中?

[英]How can I get React Native to put JS bundle in Share Extension when compiling for Release?

I can load via jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 我可以通过jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; when developing, but using jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 开发时,但使用jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; in Extension doesn't work by default. 扩展程序中的默认情况下不起作用。

I can get the file from main app's bundle through getting parent directory of parent directory but prob. 我可以通过获取父目录的父目录但可能从主应用程序的捆绑包中获取文件。 not the best way to ensure it works long-term... 不是确保其长期工作的最佳方法...

Ok it's simple enough -- I just copied Bundle React Native code and images in Build Phases from app into Extension's Build Phases. 好了,这很简单-我只是将Build Phases中的Bundle React Native code and images从应用程序复制到Extension的Build Phases中。 It does double the work, so there's prob. 它的工作量加倍,因此存在问题。 a way to get it to reuse what it did before in the extension, but this works for me for now. 一种使它可以重用以前在扩展中所做的工作的方法,但这目前对我而言有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在React Native中查看javascript包代码? - How can I view the javascript bundle code in React Native? React Native - 我如何以粗体字重分享消息? - React Native - how can i share a message in bold font weight? 如何防止Android操作系统在导航时关闭我的React Native共享扩展? - How to prevent Android OS from closing my React Native share extension when navigating away? 如何在本机反应中将填充物放在我的输入字符串上? - How can i put fillter on my input string in react native? 如何在 React Native 的 TextInput 中放置一个图标? - How can I put an icon inside a TextInput in React Native? 如何创建react native ios共享扩展应用程序 - How to create a react native ios share extension app 如何在React js中单击按钮时获取innerHTML? - How can I get innerHTML when clicking a button in React js? 如何在 React JS 中放置随机组件? - How can I put a random component in React JS? 当我将if语句放入渲染部分检查变量的值时,在react native上出现错误 - On react native when I put an if statment in the render section checking the value of a variable I get an error 在 React 注入其文件 (bundle.js) 后,如何加载 vanilla js 文件? - How can I load a vanilla js file after React injects its files (bundle.js)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM