0

これが可能かどうかはわかりませんが、Main.m で実行されている関数から UILocalNotification を起動しようとしています。これまでのところ、いくつかの異なる方法を試しましたが、単純な方法が機能しないように見えるため、誰が通知を提示する必要があるかについて少し混乱しています: Observer によって呼び出される静的関数からこのコードを呼び出します (Main. m) CTTelephonyCenter で

      UILocalNotification *localNotif = [[UILocalNotification alloc] init];
      if (localNotif) {
          NSLog(@"Ciao");
          localNotif.alertBody = [NSString stringWithFormat:
                                        @"La telefonata é finitá!!!!!"];
          localNotif.alertAction = NSLocalizedString(@"Read Message", nil);
          localNotif.soundName = @"alarmsound.caf";
          localNotif.applicationIconBadgeNumber = 1;
          [[UIApplication sharedApplication] presentLocalNotificationNow:localNotif];

       }

現在、ログは表示されますが、localNotif は表示されません。ウィンドウが定義されていないため、 Main によって呼び出された静的関数からそれを行うことはできませんか?

main.m をいじってはいけないことはわかっています。

4

1 に答える 1