开发者

iphone Simulator crash?

I'm develop app for iPhone & iPod and during developing app i used simulator 3.2(iPad) it runs perfectly but when I want to my app on simulator 3.1.3 it generate one error I remove this error by comment this line //self.clearsSelectionOnViewWillAppear = NO; and build project开发者_JS百科 successfully but run app on simulator 3.1.3 when i clicking on button it goes on another screen on 3.2 simulator perfectly & crash on 3.1.3 what i do for come out from it.


The docs for UITableViewController clearly state that clearsSelectionOnViewWillAppear is available on iOS 3.2 and above. It crashes in 3.1.3 because this property does not exist in 3.1.3 (you can easily surmise this from reading the documentation for the property that you have already discovered is causing the issue, or from looking at the error message which will indicate that the object does not respond to a selector for setClearsSelectionOnViewWillAppear.

Before setting this, you can check for this property and then set it, otherwise your older code can just be supported as is, or you could do something more advanced and add the property in pre-3.2 environments.

To check for the code, you do something like this:

if( [UITableViewController instancesRespondToSelector:@selector(setClearsSelectionOnViewWillAppear:)] ) {
  // This is 3.2+ so we can use this property
  [self setClearsSelectionOnViewWillAppear:NO];
} else {
  // This is something earlier than 3.2, so we ignore it
  NSLog(@"will clear selection: pre-3.2");
}


Can you explain your question more clearly?

My dear friend,

You should read the Apple documentation more attentively,

It is clearly stated that

clearsSelectionOnViewWillAppear

is a method available from iPhone OS 3.2 and later,you are trying to use it in 3.1.3.

So the result is obvious.

clearsSelectionOnViewWillAppear A Boolean value indicating if the controller clears the selection when the table appears.

@property(nonatomic) BOOL clearsSelectionOnViewWillAppear

Discussion The default value of this property is YES. When YES, the table view controller clears the table’s current selection when it receives a viewWillAppear: message. Setting this property to NO preserves the selection.

Availability Available in iPhone OS 3.2 and later. Declared In UITableViewController.h

Thanks

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜