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

iOSRN项目打包成SDK提供给其他原生项目集成的问题咨询 #182

Open
327635328 opened this issue Jun 11, 2020 · 9 comments
Open
Labels

Comments

@327635328
Copy link

我目前已经使用RN完成一整个iOS项目(多个bundle包模式,用于热更新),现在需要将其打成一个SDK提供给其他ios原生项目集成使用,使这个原生项目中一个按钮点击后直接跳转进RN完整项目界面流程.

我需要实现的是其他ios原生项目加进我的SDK和bundle包后就可以跑起我的RN项目,不需要去集成RN等配置RN的工作.

问题一:
我现已将iOS的原生代码打包成framework.但因为多数原生文件都需要#import <React/XXX>,所以我是将node_modules文件复制到打包framework的工程中,然后让cocoapods pod相关如"React, yoga, Folly"等等,才能使framework编译成功且生成framework.
但这样就导致如果我把目前这个半成品SDK给到另一个工程集成时,我还需要提供node_modules文件给他pod相关的东西他才能跑通我的sdk.而且也仅仅没有那么简单,他还需要去集成RN等一系列操作
这样制作出来的framework似乎是不正确的.
image
image

问题二:
RN pod的时候都是去找node_modules里面的相关文件pod进工程里面,还需要在ios工程中导入对应的Librarie及.a. 那我如何将这些第三方文件加进SDK当中?
这些Librarie都是node_modules里面一个一个工程,不知道怎么打成sdk.
image
image
image
image

问题三:
main.jsbundle如何打进SDK中?
image

问题四:
原有RN项目中的assets(存放RN图片的文件夹)是通过Create folder references形式拉进iOS工程中的,那这个assets文件该如何打进SDK?
image

@sunnylqm
Copy link

sunnylqm commented Jun 11, 2020

1 按我的理解,你想让用户完全无需关心sdk的内部实现和依赖,那么sdk应该编译成一个静态库而不是framework,参考 https://www.vadimbulavin.com/static-dynamic-frameworks-and-libraries/
2 也是应该一并打包成静态库
3、4 基本上是同一个问题,实际上2中也可能含有资源,如何将资源打包进静态库中可以参考 https://medium.com/@09mejohn/resource-bundles-in-ios-static-library-beba3070fafd

不过这都是理论,市面上并没有看到谁这样实现过,所以很难说这条路是否可行(或成本是否有实际操作的可能,比如资源的引用机制是否需要修改,如何从内核到第三方统一修改?等等)

@xiaoer-M
Copy link

遇到同样的问题,求解

@sunnylqm
Copy link

@github-actions
Copy link

github-actions bot commented May 8, 2022

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label May 8, 2022
@327635328
Copy link
Author

327635328 commented May 8, 2022 via email

@github-actions github-actions bot removed the Stale label May 10, 2022
@github-actions
Copy link

github-actions bot commented Aug 8, 2022

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Aug 8, 2022
@327635328
Copy link
Author

327635328 commented Aug 8, 2022 via email

@github-actions github-actions bot removed the Stale label Aug 9, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 8, 2022
@327635328
Copy link
Author

327635328 commented Nov 8, 2022 via email

@reactnativecn reactnativecn locked and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants