Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 对于';没有可见的@界面;UIC应用程序。。本地通知教程失败_Iphone - Fatal编程技术网

Iphone 对于';没有可见的@界面;UIC应用程序。。本地通知教程失败

Iphone 对于';没有可见的@界面;UIC应用程序。。本地通知教程失败,iphone,Iphone,刚刚学习iPhone,我发现以下错误 [app scheduledLocalNotifications:notification]; uiapplication没有可见的@interface声明选择器schedulelocalnotifications 谁能帮帮我吗。我相信这很简单,我只是没有意识到,因为这是我的第一个教程 谢谢 -(IBAction)createNotification{ NSLog(@"createNotification"); NSString *dateSt

刚刚学习iPhone,我发现以下错误

    [app scheduledLocalNotifications:notification];
uiapplication没有可见的@interface声明选择器schedulelocalnotifications

谁能帮帮我吗。我相信这很简单,我只是没有意识到,因为这是我的第一个教程

谢谢

-(IBAction)createNotification{

NSLog(@"createNotification");

NSString *dateString = dateTextField.text;
NSString *textString = textTextField.text;

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM-dd-yyyy HH:mm"];
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:-18000]];

NSDate *alertTime = [formatter dateFromString:dateString];

UIApplication* app = [UIApplication sharedApplication];

UILocalNotification *notification = [[UILocalNotification alloc] init];
if (notification) {
    notification.fireDate = alertTime;
    notification.timeZone = [NSTimeZone defaultTimeZone];
    notification.repeatInterval = 0;
    notification.alertBody = textString;

    [app scheduledLocalNotifications:notification];
    [app presentLocalNotificationNow:notification];

}

}

ScheduledLocalNotification是属性。

此属性包含UILocalNotification实例的数组 表示当前计划的本地通知。您可以设置或 重置阵列中的本地通知并访问它们

阅读文档:

更改为下面的代码

NSMutableArray *notifications = [[NSMutableArray alloc] init];
[notifications addObject:notification];
app.scheduledLocalNotifications = notifications;
//Equivalent: [app setScheduledLocalNotifications:notifications];

ScheduledLocalNotification是属性。

此属性包含UILocalNotification实例的数组 表示当前计划的本地通知。您可以设置或 重置阵列中的本地通知并访问它们

阅读文档:

更改为下面的代码

NSMutableArray *notifications = [[NSMutableArray alloc] init];
[notifications addObject:notification];
app.scheduledLocalNotifications = notifications;
//Equivalent: [app setScheduledLocalNotifications:notifications];

所以我用的是模拟器。。。通知只显示了一条横幅。。。我怎么能把它改成警报呢?它不会让我投票赞成你的答案。。。说我需要15个名声。你们解决问题后我能做些什么来标记?。。。。没关系。。明白了所以我在用模拟器。。。通知只显示了一条横幅。。。我怎么能把它改成警报呢?它不会让我投票赞成你的答案。。。说我需要15个名声。你们解决问题后我能做些什么来标记?。。。。没关系。。知道了