iOS AFNetworking(AFJSONRequestOperation)在调试但不是发布模式下工作 [英] iOS AFNetworking (AFJSONRequestOperation) works in debug but not release mode
问题描述
我在iPhone应用程序中使用AFJSONRequestOperation(针对iOS 5) - 基本上使用各种表单数据(包括图像)发布到我的网站。这很好用,实时应用程序商店版本工作正常。我做了一些更改,Apple终于接受了我的新二进制文件 - 奇怪的是POST现在从未到达我的服务器。
I'm using AFJSONRequestOperation in an iPhone app (targeting iOS 5) - basically making a post to my website with various form data (including an image). This worked fine, and the live app-store version worked fine. I made some changes and Apple finally accepted my new binary - oddly the POST never hits my server now.
首先想到:我打破了它。
回滚到原始版本,果然,它仍然坏了。
First thoughts: I broke it. Rolled back to the original release and sure enough, it is still broken.
现在奇怪的部分:在XCode中,当我将应用程序部署到我的iPhone时(或模拟器)它工作,我的服务器获得POST,一切都很好。一旦我部署了发布二进制文件,它就不会。通过Testflight尝试了一些不同的IPA,很明显Apple批准的版本不起作用。
Now the weird part: In XCode, when I deploy the app to my iPhone (or simulator) it works, my server gets the POST and all is well. As soon as I deploy a release binary, it doesn't. Tried a few different IPAs via Testflight, and it is clear that the version Apple approved doesn't work.
问题是,我显然无法调试它,因为它在调试时有效,并且之前已经完成。
Problem is, I obviously can't debug it because it works when debugging, and did previously.
有没有人有这种经历,或者知道潜在的旅行?
Anyone had this experience, or know of a potential trip-up here?
我完全被难倒了。
推荐答案
您可以更改xcode运行应用方案以使用发布版本,转到编辑方案,选择运行,然后选择构建配置(在信息选项卡下) )'发布'。
You can change the xcode 'Run app' scheme to use a release build, goto 'edit scheme', select 'run', then 'Build configuration' (under the 'Info' tab) to 'Release'.
虽然不会很完美,但由于优化程序重新排序代码等原因,您在调试时会遇到一些奇怪的问题。您可能需要添加大量NSLog()来跟踪代码所采用的路径。
It won't be perfect though, you'll get some oddities when debugging due to the optimiser having reordered code etc. You may have to add a large number of NSLog()s to trace through what path the code takes.
这篇关于iOS AFNetworking(AFJSONRequestOperation)在调试但不是发布模式下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!