简体   繁体   English

如何与ShareExtension iOS共享现有的主要应用程序源代码?

[英]How to share existing main app source code with ShareExtension iOS?

I am working on building a ShareExtension for my app. 我正在为我的应用程序构建一个ShareExtension。 I have replaced custom view[SLComposeServiceViewController] with main app's ViewController. 我已经用主应用程序的ViewController替换了自定义view [SLComposeServiceViewController]。

Well in this scenario, I have to set target of main ViewController with the share extension. 在这种情况下,我必须使用共享扩展名设置主ViewController的目标。 The problem I faced doing this is, my main app's view controller is heavy and has lot of code inside it. 我遇到的问题是,我的主应用程序的视图控制器很重,并且其中包含很多代码。 I am getting many build time errors and I am solving it manually by adding all the dependency class target to my share extension. 我遇到许多构建时错误,并且通过将所有依赖关系类目标添加到我的共享扩展中来手动解决它。

My question here is, Is there any better way to do this? 我的问题是,还有更好的方法吗? Is there any better way to share all the code with extension by adding entire main app code to extension target ? 通过将整个主应用程序代码添加到扩展目标,是否有更好的方法与扩展共享所有代码?

Thanks in advance. 提前致谢。

Its better to keep seperate UI and class for share extension . 最好保留单独的UI和类以进行共享扩展。 As Apple suggest Extensions should be kept light weight . 正如苹果建议的那样,扩展程序应保持轻量化。

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

相关问题 如何通过shareExtension将Safari整页截图分享到我的应用程序 - How to share Safari full page screenshot to my app through shareExtension iOS ShareExtension 应用程序中的数据共享问题 - Data sharing issue in iOS ShareExtension app 如何通过iOS应用程序将现有的Facebook帖子分享到用户时间轴? - How to share an existing facebook post to user timeline from an iOS app? 如何与我的主应用程序和 iOS 应用程序的应用程序扩展正确共享 Amplify 框架? - How can I properly share the Amplify framework with my Main App and my App Extension for an iOS app? 如何在主iOS应用与其共享扩展之间使用相同的经过身份验证的用户令牌 - How to use same Authenticated user token between main iOS app and its Share Extension 如何共享一个现有的iOS供应配置文件(或应提交的应用)? - How does one share an existing iOS provisioning profile (or app due for submission)? 在iOS 8中使用共享扩展名时如何获取源应用程序的bundleId - How to get bundleId of the source app when using share extension in IOS8 主应用程序和共享扩展名之间的iOS共享.h文件 - iOS Sharing .h file between main app and share extension 从iOS Safari共享扩展打开主应用 - Open the main app from a iOS Safari Share Extension 用于在共享扩展和iOS应用之间共享文件路径/文件的代码 - Code to share file path/file between a share extension and iOS app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM