[英]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.