このようにタイマーを追加します
tim=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(repeatTim) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:tim forMode:NSDefaultRunLoopMode];
timそれは私のクラスの NSTimer プロパティです。
次に、ボタンのクリックで停止します
[[fbt tim] invalidate];
[fbt setTim:nil];
fbt それは私のクラスのインスタンスです。
無効化のみを呼び出すと停止しませんが、nil に設定すると EXC_BREAKPOINT を取得しました
セレクターのrepeatTimメソッドのコード
AppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
[appDelegate.wbv stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"intal()"]];
initを呼び出して無効化しようとしました
dispatch_async(dispatch_get_main_queue(), ^{})
タイマーも止まりません。