构建 iOS 应用程序不会在 iPhone 或模拟器上更新 [英] Building iOS App does not update on iPhone or Simulator

查看:30
本文介绍了构建 iOS 应用程序不会在 iPhone 或模拟器上更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Xamarin.iOS for Visual Studio 启动一个 iOS 项目,该项目链接到 Mac 构建主机和连接的 iPhone.

I am trying to get an iOS project started with Xamarin.iOS for Visual Studio linked to a Mac build host and connected iPhone.

我已经在我的 PC 上的 Visual Studio、Mac 上的 Xamarin Studio 和 Mac 上的 XCode 7 中启动了虚拟项目.他们都有这个问题.

I have started dummy projects in Visual Studio on my PC, Xamarin Studio on the Mac, and XCode 7 on the Mac. They all share this problem.

我尝试在物理 iPhone 和 Mac 模拟器上运行构建.尽管我做出了所有努力,但问题仍然存在.

I have tried running the build on both the physical iPhone and a Simulator on the Mac. The problem persists for both despite all my efforts.

问题是:测试应用的第一个版本是运行的.如果我进行任何更改并重新构建,这些更改将永远不会反映在手机或模拟器上运行的应用程序中.它将始终运行我做过的第一个构建,并且调试器拒绝附加.

The problem is this: The first version ever built of the test app is the one that runs. If I make ANY changes and rebuild, those changes will NEVER be reflected in the app running on the phone or simulator. It will ALWAYS run the first build I ever made, and the debugger refuses to attach.

我尝试在两次构建之间从手机中删除该应用程序.我曾尝试在两次构建之间从 Visual Studio 解决方案中的所有项目中删除所有 bin 和 obj 文件.如果我能在 Mac 上为 Xamarin Studio、XCode 或 Xamarin Mac Build 主机找到任何类似的文件,我也会删除它们,但我不熟悉 Mac 的构建过程或文件系统.尽管如此,这是一个无论如何都不应该发生的问题.

I have tried deleting the app from the phone between builds. I have tried deleting all bin and obj files from all projects in the Visual Studio solution between builds. If I could find any similar files on the Mac for Xamarin Studio, XCode, or the Xamarin Mac Build host, I would delete them too, but I'm unfamiliar with the build process or file system of a Mac. Still, this is a problem that shouldn't be happening Regardless.

我什至尝试过重新启动 Visual Studio.我会尝试重新启动我的设置的其他部分(Xamarin 构建主机、Xamarin Studio、XCode、iPhone 和 iPhone 模拟器),但决定不打扰,因为在每次构建之间重新启动组件是不可接受的,也不是解决方案.

I have even tried restarting Visual Studio. I would have tried restarting the other parts of my setup (the Xamarin Build Host, Xamarin Studio, XCode, the iPhone, and the iPhone Simulator), but decided not to bother, since restarting components between every build is unacceptable and not a solution.

我在网络上进行的所有搜索都只会带来与 Apple Provisioning 相关的主题以进行测试部署.没什么用.非常令人沮丧.有没有人知道这里会发生什么?

All searches I do on the web only bring up topics related to Apple Provisioning for test deployment. Nothing useful. Very frustrating. Does anyone have any idea what might be going on here?

更正.在 Mac 上的 Xamarin Studio 中所做的更改会反映在构建/运行中,但不会反映在通过构建主机链接的 PC 上的 Visual Studio 或 XCode.

Correction. Changes made in Xamarin Studio on the Mac are reflected on build/run, but not from Visual Studio on the PC linked via Build Host, or from XCode.

另请注意:所有 3 个测试应用在其 plist 文件(com.somecompany.-")中都使用相同的应用标识.在一个环境中构建时(比如 Visual Studio),它会覆盖上次使用的环境(比如 XCode)的版本,但它仍然会使用在构建环境中创建的第一个版本.

Also note: All 3 test apps use the same app identity in their plist files ("com.somecompany.-"). And when building in one environment (say Visual Studio) it WILL overwrite the version from the last environment used (say XCode), but it will still use the first version ever made in the environment being built from.

例如,如果 Visual Studio 项目的主页上有一个标签说这是 VS 版本.",而 XCode 项目标签说这是 XCode 版本.",我可以构建/调试任何一个,标签都会在电话上说出预期的内容.

So for example, if the main page on the Visual Studio project has a label saying "This is the VS version.", and the XCode project label says "This is the XCode version.", I can build/debug in either one, and the label will say the expected thing on the phone.

但是如果我以某种方式更改这些标签,例如在它们的末尾添加duh...",那么他们会说这是 VS 版本.duh..."和这是 Xcode 版本.呃...",无论我在任一环境中构建和运行多少次,该应用程序仍然只会说这是 VS 版本."或这是 XCode 版本."

But if I change those labels in some way, like by adding " duh..." to the end of them so they say "This is the VS version. duh..." and "This is the Xcode version. duh...", no matter how many times I build and run in either environment, the app will still just say "This is the VS version." or "This is the XCode version."

推荐答案

部分解决.(针对带有构建主机的 Visual Studio 解决,不适用于 XCode)

Partially solved. (Solved for Visual Studio with Build Host, not for XCode)

在 Visual Studio 中,测试项目是一个 Xamarin.Forms 解决方案,这意味着它包含一个库项目——TestApp(便携式)"——以及它应该为其构建的每个平台的其他项目——TestApp.iOS"、TestApp.Driod"等

In Visual Studio, the test project is a Xamarin.Forms solution, meaning that it consists of a library project--"TestApp (Portable)"--and other projects for each platform it should build for--"TestApp.iOS", "TestApp.Driod", etc.

通过右键单击解决方案并调出其属性,然后转到配置属性 -> 配置,我能够看到由于某种原因该库项目未设置为构建.所以 iOS 项目会构建,一切都会看起来就像编译器在做它的工作一样,但 iOS 项目仍在构建非重建库.

By right clicking on the solution and bringing up its properties, then going to Configuration Properties -> Configuration, I was able to see that the library project was not set to build for some reason. So the iOS project would build, and everything would LOOK like the compiler was doing it's job, but the iOS project was still building off the non-rebuilt library.

在 TestApp 库项目上选中构建"框并应用后,一切正常.调试器甚至会再次附加.

After checking the box for "Build" on the TestApp library project and applying, everything worked. The debugger even attaches again.

不幸的是,XCode 仍然是一个不直观且神秘无用的碎片.仍将感谢有关其在此问题上的行为的答复.

Unfortunately, XCode still remains an unintuitive and mysteriously useless piece of scrap. Answers regarding its behavior on this matter would still be appreciated.

这篇关于构建 iOS 应用程序不会在 iPhone 或模拟器上更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆