英文:
How to ensure Xamarin.ios extension project deploys with main project
问题
我正在尝试将内部共享添加到现有的Xamarin.iOS项目中,使用Visual Studio。我已经添加了一个共享扩展项目(使用VS中的模板项目),但是当我在设备上进行测试时,在操作系统的共享屏幕上什么都没有显示出来。我已经构建并测试了一个MS示例,它可以正常工作并显示在设备上。
我认为问题可能是在测试时我的应用程序的第二个EXE根本没有部署。当我按F5在连接的设备上运行MS项目时,生成输出窗口包含以下行:
复制文件 - 完成百分比:40%
复制文件 - 路径:/var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.aotdata.arm64
复制文件 - 路径:/var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.aotdata.arm64
复制文件 - 完成百分比:41%
复制文件 - 路径:/var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.dll
复制文件 - 完成百分比:41%
复制文件 - 路径:/var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.dll
复制文件 - 完成百分比:41%
复制文件 - 路径:/var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.dll
复制文件 - 完成百分比:42%
复制文件 - 路径:/var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/libmono-native-compat.dylib
很明显,它正在将第二个项目复制到/plugins/子文件夹中。然而,当我按F5运行我的应用程序时,生成输出中有许多关于我的主项目及其资源等的行,但没有关于第二个项目的等效行,也没有任何提到插件子文件夹的参考。
在我的应用程序解决方案中,我已经设置了扩展项目的构建(在配置管理器中,对于xamarin.ios,部署复选框不可用)。在解决方案属性中,我已经将我的主项目设置为依赖于第二个项目。我已经验证第二个项目确实构建:如果我引入错误,或者更改其ID以使bundle ID不再匹配我的通配符配置文件,则构建和部署将以错误终止。
如何确保扩展项目包含在测试解决方案(从VS中)和构建IPA(用于上传)时?
英文:
I am trying to add inward sharing to an existing Xamarin.iOS project in Visual Studio. I have added a share extension project (using the template project in VS), however when I test on the device nothing shows in the OS sharing screen. I've built and tested a MS sample which works fine and does show on the device.
I think the problem is that the second EXE for my app isn't being deployed at all when I test. When I press F5 to run the MS project on an attached device, the Build Output window includes lines such as:
CopyingFile - PercentComplete: 40%
CopyingFile - Path: /var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.aotdata.arm64
CopyingFile - Path: /var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.aotdata.arm64
CopyingFile - PercentComplete: 41%
CopyingFile - Path: /var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.dll
CopyingFile - PercentComplete: 41%
CopyingFile - Path: /var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.dll
CopyingFile - PercentComplete: 41%
CopyingFile - Path: /var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/ShareExtension.dll
CopyingFile - PercentComplete: 42%
CopyingFile - Path: /var/folders/ns/vw2n_fhd58d3v21nv64s4fhw0000gn/T/Xamarin.iOS_InstallShadowPath/Share.app.mXLJ6c/Share.app_sparse.ipa/Payload/Share.app/PlugIns/ShareExtension.appex/libmono-native-compat.dylib
It is clearly copying the second project to the /plugins/ sub-folder. However when I press F5 for my own app there are numerous lines in the build output for my main project and its resources etc, but no such equivalent for the second project, or any reference to a plugins sub-folder.
In my app's solution I have set the extension project to build (and the deployment tick box is not available for xamarin.ios in the configuration manager). In the solution properties I've set my main project as dependent on the second project. I have verified that the second project does build: if I introduce an error, or change its ID such that the bundle ID no longer matches my wildcarded provisioning profile then the build and deploy terminates with an error.
How do I ensure that the extension project is included (both when testing the solution from VS and when building an IPA for upload)?
答案1
得分: 1
需要引用共享扩展部分以确保它包含在构建的二进制文件中。但是,这不会使应用程序在共享时出现,您需要在共享扩展的info.plist
文件中指定您的应用程序接收什么。
英文:
You need to reference the share extension from the main project to ensure that it is included in the built binary.
However, that won't grant that the app will appear while you share, you need to specify what your app receives in the info.plist
file of your share extension.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论