iphone应用程序分发构建包含一个错误 [英] iphone application distribution build contains a bug

查看:121
本文介绍了iphone应用程序分发构建包含一个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案
这已在许多人的帮助下解决。我现在在写这个,以便有类似问题的人可以从中受益。为了重建这个bug,我不得不在我的设备上运行分发版本。这是根据MrMage的建议完成的,它告诉我将证书更改为开发人员,而不是分发。这允许我重新创建错误和调试它。问题原因是,编译器忽略所有的调用设置一个CGSize的值。我可以通过将目标偏好设置中的优化级别设置为无,而不是最快,最小来防止这种情况。






你好,



我在我的应用程序中有一个很奇怪的地方。几天前,我的应用程序被批准进入应用商店,但对我的恐怖,我很快发现,它有一个重大的错误。我去了我的电脑,但当一个运行的代码(在模拟器和设备),它一切工作完美。我已经尝试过一切:重新编译并提交更新,清除所有目标,重新安装SDK等。



这里是对问题的更详细的描述。我在我的应用程序中有一个详细信息表视图,从一个在线源加载一些数据。它在下载时显示加载视图,然后在设置数据源后重新加载tableview。表格的单元格包含UITextViews,它会更改大小以适合文本。当我在计算机上运行应用程序或在设备上调试时,文本被下载并完美显示,但是当我从App Store下载并启动它时,它将只显示文本,然后留空休息。我知道数据被下载,因为texviews调整自己适合的文本,他们只是不显示它。



任何人都知道什么可能是导致此错误?我如何知道我的发行版本是否包含错误,它不会显示在调试版本中?



您的,
BEN。



PS:我已经比较了调试和分发版本的目标设置。我看到的唯一区别是优化级别下的代码生成。我试图改变这个调试生成,但它不会揭示问题。






编辑:我解决了这个问题是由MrMage提出的。事实证明,这段代码确实是错误的原因。当在调试器中运行时,'s'的宽度和高度属性始终为零,我不能改变这一点。我正在调查为什么会发生这种情况。

   - (void)setText:(NSString *)string 
{

CGSize s = [string sizeWithFont:textView.font constrainedToSize:CGSizeMake(290,FLT_MAX)];
s.height + = kStaticSize;

// SizeWithFont是非常不可靠的,所以有一些脏的调整
if(s.height> 100& s.height< = 250)
s .height + = 20;
else if(s.height> 250& s.height< = 500)
s.height + = 40;
else if(s.height> 500& s.height< = 800)
s.height + = 50;
else if(s.height> 800& s.height< = 1200)
s.height + = 60;
else if(s.height> 1200& s.height< = 1700)
s.height + = 100;
else if(s.height> 1700)
s.height + = 200;

s.width = 290;
CGRect r = textView.frame;
r.size = s;
[textView setFrame:r];

[self.textView setText:string];
[self.textView setNeedsDisplay];

}


解决方案

尝试只是采取您的分发版本配置和更改其代码签名选项到iPhone开发人员,然后测试在您的设备上构建?



据我所知,还可以立即上传使用开发人员证书签名的二进制文件。因此,您可以开发一个有效的开发人员版本,并将其提交给Apple。


Solution: This has been solved following the assistance of many people. I'm now writing this, so that people with similar problems can benefit from it. In order for me to recreate this bug, I had to run the distribution build on my device. This was accomplished following MrMage's advice, which told me to change the certificate to the developer, and not the distribution. This allowed me recreate the error and debug it. The problem turned out to be that the compiler was ignoring all calls to set a CGSize's values. I was able to prevent this by setting the "Optimization Level" in the target preferences to "None", instead of "Fastest, Smallest".


Hello there,

I have a very peculiar in my application. A few days ago, my app got approved into the app store, but to my horror I soon discovered that there was a major bug in it. I went to my computer, but when a ran the code(both in the simulator and on the device), it all worked perfectly. I have tried everything: recompile and commit an update, clean all targets, reinstall the SDK, etc.

Here is a more detailed description of the problem. I have a detail table view in my application which loads some data from an online source. It displays a loading view while it downloads, and then reloads the tableview once the datasource is set. The table's cells contain UITextViews, which changes size to fit the text. When I run the app on the computer, or debugging on the device, the text is downloaded and displayed perfectly, but when I download from the App Store and launch it, it will only display text the first time, and then leave blank for the rest. I know the data gets downloaded because the texviews resize themselves to fit the text, they just don't display it.

Do anybody know what might be causing this error? How can I know whether my distribution build contains an error, which doesn't show up in the debug build?

Yours, BEN.

PS: I have compared the target settings for the debug and distribution builds. The only difference I see is "Optimization level" under "Code generation". I have tried to change this for the debug build, but it doesn't reveal the problem.


EDIT: I solved the problem by doing what MrMage suggested. It turns out that this code is indeed the cause of the error. When running in the debugger, the width and height properties of 's' are constantly zero, and I can't change this no matter what. I'm looking into why this happens.

- (void) setText:(NSString *)string 
{

CGSize s = [string sizeWithFont:textView.font constrainedToSize:CGSizeMake(290, FLT_MAX)];
s.height += kStaticSize;

//SizeWithFont is very unreliable so have to do some dirty tweaking
if (s.height > 100 && s.height <= 250)
    s.height += 20;
else if (s.height > 250 && s.height <= 500) 
    s.height += 40;
else if (s.height > 500 && s.height <= 800 )
    s.height += 50;
else if (s.height > 800 && s.height <= 1200)
    s.height += 60;
else if (s.height > 1200 && s.height <= 1700)
    s.height += 100;
else if (s.height > 1700) 
    s.height += 200;

s.width = 290;
CGRect r = textView.frame; 
r.size = s;
[textView setFrame:r];

[self.textView setText: string];
[self.textView setNeedsDisplay];

}

解决方案

Did you try to just take your distribution build configuration and change its code signing options to iPhone developer, and then test that build on your device?

As far as I know, you can also upload binaries signed with a developer certificate by now. So you could take a working developer build and submit that one to Apple.

这篇关于iphone应用程序分发构建包含一个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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