私はアプリがフォアグラウンドに入るときに通知を掲示するために、この機能を追加するためのstucked:私自身のクラスでのiOSアプリapplicationWillEnterForeground、それしばらく
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[[NSNotificationCenter defaultCenter] postNotificationName: @"UIApplicationWillEnterForegroundNotification" object: nil];
}
:
- (void) handleEnterForeground: (NSNotification*) sender
{
[self reloadTableData];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(handleEnterForeground:)
name: @"UIApplicationWillEnterForegroundNotification"
object: nil];
}
しかしhandleEnterForeground:機能二度呼ばれる、私はなぜ知りません。 reloadTableData:関数はリモートWebServiceを呼び出します。そのため、アプリケーションが フォアグラウンドを入力すると、しばらくの間突っ込んでしまいます.Plsがこれを手伝ってくれてありがとう。
彼はどこで2回発砲していますか? – cnu
私はその機能を一度呼びました。 – jxdwinter
@cnu * he *は一度発射し、iOSランタイムは一度発射しています。このイベントは自動的に呼び出されます。 – borrrden