2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

twitter等をWebViewで開くと落ちる場合の対処

Posted at

他サイトによると下記を実行すればOKとあったが、実質4のみで大丈夫っぽいです。
1・delegateを解除
2・ロードをストップ
3・アニメーションを止める
4・webViewを親から取り外す

/************************************************************
*
************************************************************/
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.view addSubview:webView];
}

/************************************************************
*
************************************************************/

  • (void) viewDidDisappear:(BOOL)animated
    {
    [super viewDidDisappear:animated];
    if (self.webView != nil) {
    [webView removeFromSuperview];
    }
    }

なぜかdeallocやdidMoveToParentViewControllerでは駄目らしいね。
たぶんこの辺はメソッドのコール順序をしっかり把握すれば分かりそうだけど、
それはまたの機会に。。。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?