开发者

iOS different output whether running in simulator or on device

I yet again have a super weird problem. I get different outputs whether I'm running the application on the simulator or on the iPhone.

See these console logs:

iPhone First run, first career cell clicked

2011-06-23 14:47:28.974 Acando[2033:307] 1 - loadView method running
2011-06-23 14:47:29.156 Acando[2033:307] 2 - viewDidLoad method running
2011-06-23 14:47:29.159 Acando[2033:307] 3 - viewWillAppear method running
[Switching to process 12803 thread 0x0]
[Switching to process 11523 thread 0x0]
2011-06-23 14:47:29.689 Acando[2033:307] 4 - viewDidAppear method running
2011-06-23 14:47:29.692 Acando[2033:307] View: UILabel, height: 21.000000
2011-06-23 14:47:29.695 Acando[2033:307] View: UIWebView, height: 400.000000
2011-06-23 14:47:29.851 Acando[2033:307] webViewDidFinishLoad method running
2011-06-23 14:47:29.855 Acando[2033:307] UIWebView dynamic height: 1150.000000
[Switching to process 12547 thread 0x0]

Simulator First run, first career cell clicked

2011-06-23 14:46:26.405 Acando[92098:207] 1 - loadView method running
2011-06-23 14:46:26.421 Acando[92098:207] 2 - viewDidLoad method running
2011-06-23 14:46:26.422 Acando[92098:207] 3 - viewWillAppear method running
[Switching to process 92098 thread 0x2003]
[Switching to process 92098 thread 0x207]
2011-06-23 14:46:26.484 Acando[92098:207] webViewDidFinishLoad method running
2011-06-23 14:46:26.485 Acando[92098:207] UIWebView dynamic height: 1150.000000
[Switching to process 92098 thread 0x6703]
2011-06-23 14:46:26.781 Acando[92098:207] 4 - viewDidAppear method running
2011-06-23 14:46:26.782 Acando[92098:207] View: UILabel, height: 21.000000
2011-06-23 14:46:26.783 Acando[92098:207] View: UIWebView, height: 1150.000000

It seems that on the iPhone, the method webViewDidFinishLoad is loaded after the viewDidAppear method.

But on the simulator the webViewDidFinishLoad is loaded before the viewDidAppear method.

What gives?

EDIT: What is even more weird is that this only happens when I click on the firs开发者_JS百科t cell that loads the viewcontroller which has my UIScrollView and UIWebView. All the subsequent cells that I click on the webViewDidFinishLoad method is loaded before the viewDidAppear method.

There has got be some way I can correct this?


You should take into account data Internet connexion on the Simulator is far better than the one on the iPhone device. Be careful when working with synchronous and multithreading.


Your threads are executing in different orders on the phone, vs the simulator. This is not so much a bug as a feature of multi threaded programming. Are you getting crashes in your program or just curious on the execution order?


The simulator is running x86 compiled code in a simulated environment. There are bound to be some differences.

This is why you should always test on an actual device and not rely entirely on the simulator for your testing results.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜