开发者

iphone application distribution build contains a bug

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开发者_StackOverflow = [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.


Did you ever test an optimized build? The optimizer can do some really funky things (like rearrange your code), and this might cause problems if you have an uninitialized variable.

I'd also suggest running Clang (do a Build & Analyze).


How have you changed your code since the update? (I hope you're using some form of version control) I don't think target settings would have much to do with it.

In the meantime I would remove it from the store if its that critical of an error. Then work on making the next release stable and extensively testing it.

(I don't think you need to use custom tableView cells to resize the text, I'm pretty sure the stock Apple ones do that automatically.)


Under the heading of wild guessing.

I would look at any difference between you development environment and normal operational environment. For example, in my development environment, my iPhone defaults to my wifi for everything except phone calls. Since some network operations are time and bandwidth sensitive, it might be that operating over 3G/edge is the problem.

I am trying to think of what could cause the textviews to scale to hold text but not display the text. The textview can't scale to fit if it has nothing to fit. This suggest that either the text is composed of white spaces or that that the alpha of the text color is zero for some reason. Do you do anything setting the text color/font?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜