简体   繁体   English

模拟器和设备给出不同的结果

[英]Simulator and device give different results

Have any of you ever ran into issues where the changes you've made are only being reflected on the simulator and not on the device? 你有没有遇到过这样的问题,你所做的改变只是反映在模拟器而不是设备上?

Example, if i want to set the selected background image view for a table cell, the selection state in the simulator will show the changes but not on the device during testing. 例如,如果我想为表格单元格设置所选背景图像视图,则模拟器中的选择状态将显示更改,但在测试期间不会显示在设备上。

This inconsistency is starting to worry me because when it's time to deploy to production, how do i know that the apps in the app store will work correctly? 这种不一致性开始让我担心,因为在部署到生产时,我怎么知道应用程序商店中的应用程序才能正常工作?

Thanks 谢谢

Have any of you ever ran into issues where the changes you've made are only being reflected on the simulator and not on the device? 你有没有遇到过这样的问题,你所做的改变只是反映在模拟器而不是设备上?

Yes, this has happened to me many times. 是的,这种情况多次发生在我身上。

This inconsistency is starting to worry me because when it's time to deploy to production, how do i know that the apps in the app store will work correctly? 这种不一致性开始让我担心,因为在部署到生产时,我怎么知道应用程序商店中的应用程序才能正常工作?

When I first started developing for iPhone, I once had to rewrite a significant portion of code because while it worked perfectly in the Simulator, it did not work properly on the iPhone. 当我第一次开始为iPhone开发时,我曾经不得不重写大部分代码,因为虽然它在模拟器中完美运行,但它在iPhone上无法正常工作。 I realized then that the Simulator is not an Emulator, that is, it does not replicate an iPhone exactly. 我意识到模拟器不是模拟器,也就是说,它不能完全复制iPhone。

You need to test on an iOS device frequently to ensure that your code is working properly. 您需要经常在iOS设备上进行测试,以确保您的代码正常运行。 That is what the App Store reviewers will be using and what your users will be using, not the Simulator. 这就是App Store评论员将使用的内容以及您的用户将使用的内容,而不是模拟器。

During your daily development, you can use the Simulator and also your fastest device, like the 5th gen iPod Touch and iPhone 5. Periodically and towards the end of your development, it is good to test on older, slower, more memory limited devices, especially the oldest available that will run the iOS version that you are targeting. 在您的日常开发过程中,您可以使用模拟器以及最快的设备,例如第5代iPod Touch和iPhone 5.定期和开发结束时,最好在较旧,速度较慢,内存受限的设备上进行测试,特别是可用于运行您所定位的iOS版本的最旧版本。

The best thing you can do when this happens is to uninstall the app your're developing, (extra measure) restart the device to clean any app caches, and finally do a clean build from XCode. 发生这种情况时,您可以做的最好的事情是卸载正在开发的应用程序,(额外措施)重新启动设备以清理任何应用程序缓存,最后从XCode执行干净的构建。 Things like this tend to happen to me frequently and uninstalling my app followed by a clean build seems to do the trick all the time. 像这样的事情往往发生在我身上,卸载我的应用程序,然后干净的构建似乎一直在做的伎俩。

Inconsistencies happen, that's why you need to test on actual devices (and why it's a simulator, not an emulator). 发生不一致,这就是为什么你需要在实际设备上进行测试(以及为什么它是模拟器,而不是模拟器)。 In this case, it's most likely being caused by XCode failing to properly update the program, in particular the nibs. 在这种情况下,最有可能的原因是XCode无法正确更新程序,特别是nib。 Delete your app from the phone and reinstall it fresh. 从手机中删除您的应用并重新安装。 The app store and iTunes use a different method of installation, so you shouldn't have to worry about it in the store. 应用程序商店和iTunes使用不同的安装方法,因此您不必在商店中担心它。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM