2014年9月3日水曜日

ワーニング Capturing 'self' strongly in this block is likely to lead to a retain cycle

Capturing 'self' strongly in this block is likely to lead to a retain cycle

こんなエラーが出てしまった。

    [oPageView setViewControllers:nextPage direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:^(BOOL finished) {
        [oTableView scrollToRowAtIndexPath:iPagePath atScrollPosition:UITableViewScrollPositionTop animated:YES];

    }];


Blockの中にインスタント変数を参照するとワーニングになります。

    __block UITableView *tablViewself = oTableView;
    [oPageView setViewControllers:nextPage direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:^(BOOL finished) {
        [tablViewself scrollToRowAtIndexPath:iPagePath atScrollPosition:UITableViewScrollPositionTop animated:YES];
    }];


こんな感じで、変数を外だしにするとOKです。

Warning ワーニング 'UITextAlignmentCenter' is deprecated: first deprecated in iOS 6.0

'UITextAlignmentCenter' is deprecated: first deprecated in iOS 6.0


こんなワーニングがでました。



×  [self.title setTextAlignment:UITextAlignmentCenter];
        

   [self.title setTextAlignment:NSTextAlignmentCenter];

上のように変更したら、oKになりました。

Warning ワーニング Property access result unused - getters should not be used for side effects

 Property access result unused - getters should not be used for side effects

こんなワーニングだ出ていました。


調べたところ、

オブジェクト.関数名

となっているところを

[オブジェクト 関数名]
にすると
OKでした。



oWebView.goBack;
[oWebView goBack];