State Preservation/Restoration UIDataSourceModelAssociation failing
| Originator: | phillips1988 | ||
| Number: | rdar://13816959 | Date Originated: | 6-may-2013 |
| Status: | Duplicate | Resolved: | |
| Product: | iOS SDK | Product Version: | 6.0 |
| Classification: | Serious Bug | Reproducible: | Always |
Duplicate of: 13480007 Summary: Using the UIDataSourceModelAssociation protocol for UITableView and UICollectionView isn't working as expected. In the case of UICollectionView no methods of this protocol are being called. For UITableView modelIdentifierForElementAtIndexPath:inView: is called on application going to background and on application returning to foreground, indexPathForElementWithModelIdentifier:inView: is never called. Steps to Reproduce: Please find attached my sample project. I am using NSLog to track in the console what is being called and in which order. When state preservation occurs encodeRestorableStateWithCoder: is being called on both my table and collection view controllers, the table view controller also receives a message to modelIdentifierForElementAtIndexPath:inView:. On State restoration both controllers receive a message to their decodeRestorableStateWithCoder: implementations, and the table view controller also has its modelIdentifierForElementAtIndexPath:inView: method called again. Expected Results: On state preservation, the expected methods to be called should be encodeRestorableStateWithCoder: and modelIdentifierForElementAtIndexPath:inView: for both the table view controller and the collection view controller. During state restoration, the expected methods to be called by the system should be decodeRestorableStateWithCoder: and indexPathForElementWithModelIdentifier:inView: for both table view and collection view controllers. Actual Results: During state preservation doesn't call my implementation of modelIdentifierForElementAtIndexPath:inView: for my collection view controller. During state restoration the system doesn't message my implementation of indexPathForElementWithModelIdentifier:inView: for both the table view controller and the collection view controller. Also during state restoration the table view controller receives another call to my implementation of modelIdentifierForElementAtIndexPath:inView: (which should only be used when preserving state). Sample project: https://bitbucket.org/danielphillips/state-bug-demo
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!