After I updated my Xcode to 4.6, I got several compiling errors when I tried to compile my app. It seems that they are iOS 6 related. Most of them are easy to fix. However, I had a little bit hard time to nail down two.
The first one is block related. I used self within block. In Xcode 4.6, this is a potential memory issue: Capturing 'self' strongly in this block is likely to lead to a retain cycle. With the help of SO, I quickly found the solution: using __weak prefix to capture self as none-retaining variable. Then use the var in the block.
if (entity.imagePath) {
__weak UITableViewController *weakSelf = self;
// Load image from entity to doc helper with handler
[self.docHelper addImageDocs:myDoc
withCompleteHandler:^{
[weakSelf.tableView reloadRowsAtIndexPaths:
aPath
withRowAnimation:UITableViewRowAnimationBottom];
}];
}
The second one was tough for me, because it is Storyboard related. The warning only indicates a potential issue but I could not locate it: table view background color is deprecated in ios 6.0. In a similar way, I got an answer from SO. But in my case, I have too many views and components. It is hard to locate the issue. Eventually, I found a way to view the storyboard as XML text and soon I located the deprecated color. I submitted my answer to SO.
References
- SO answer: Retain cycle on `self` with blocks
- My submission to OS: Is groupTableViewBackgroundColor deprecated on iOS 6?
0 comments:
Post a Comment