アラームが鳴ったときにudpデータを送信するアラームアプリを作成しています。現時点では、アラームが解除されたときではなく、アラームが設定されるとすぐにUDPデータが送信されます。私はif文を使ってこれを行うことができると思っていましたか?私はこれがコードの正しいビットだと思う。助けてください!!if文による警告表示
-(void)scheduleloalNotificationWithDate:(NSDate *)fireDate {
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = fireDate;
notification.alertBody = @"Time For Coffee!";
SwitchOn= [sendOn dataUsingEncoding:NSUTF8StringEncoding];
NSString *newIP = [setting IP];
NSLog(@"IP = %@", newIP);
if(!newIP){
[socket sendData: SwitchOn toHost: @"192.168.0.2" port: 5900 withTimeout:-1 tag:1];
// NSLog(@"cancel");
}
else{
[socket sendData:SwitchOn toHost: newIP port: 5900 withTimeout:-1 tag:1];
}
[[UIApplication sharedApplication] scheduleLocalNotification: notification];
[notification release];
}
で
c
を見逃しているPS? –