我在我的应用程序中使用UILocalNotification来安排通知.通知工作正常,并在我需要时显示.我没有这个问题.我没有做任何远程/推送通知.
令我疑惑的是,我从未在几个应用程序中看到过您通常看到的推送通知的着名权限对话框.我甚至重置了我的设备并运行了我的应用程序 这仍然没有导致权限对话框出现.
如果您的应用仅使用本地通知,或者我没有实现某些实际导致应用请求此权限的方法,是否会显示此权限对话框?
我知道我可以在应用程序启动后实现我自己的对话框,要求用户提供此权限,但我希望Apple能够解决这个问题,特别是因为它在设置应用程序中对待远程和本地通知.
我希望在本地通知被触发时显示警告,但为此我必须请求许可,因为当我在iPhone上运行应用程序时,它对我说:
尝试安排本地通知{开火日期= 2014年6月13日星期五12小时10分27秒中欧夏令时,时区=(null),重复间隔= 0,重复计数= UILocalNotificationInfiniteRepeatCount,下次开火日期= 2014年6月13日星期五12小时10分27秒中欧夏令时,用户信息=(null)}带有提醒但未收到用户显示提醒的权限
我怎样才能做到这一点?这是现在的代码:
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = [[NSDate date] dateByAddingTimeInterval:timeUntilNotification];
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.alertBody = @"ZEIT!";
localNotif.alertAction = @"Show me the Timer!";
localNotif.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] +1;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
Run Code Online (Sandbox Code Playgroud) 我有3个Estimote信标,可以在App Store Estimate App中看到.
现在我正在尝试运行Apple演示应用程序AirLocation AirLocate
我已将APLDefaults.m文件中的UUID更改为默认的Estimote UUID _supportedProximityUUIDs = @[[[NSUUID alloc] initWithUUIDString:@"B9407F30-F5F8-466E-AFF9-25556B57FE6D"]];
我已启用Region启动,startMonitoringForRegion因为此stackoverflow说.
但他们没有露面,你见过这个吗?或者我错过了一些具体的估计.
问候
iOS 8中的推送通知不起作用.
错误显示:
implicit conversion of 'unsigned long 'UIUserNotificationSettings *' is disallowed with arc
Run Code Online (Sandbox Code Playgroud)
码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application registerUserNotificationSettings:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用ios 8.0和xcode 6 beta.
我正在为 Apple Watch 开发一个计时器应用程序。
在特定时间(计时器结束),iPhone 会触发计划UILocalNotification,在不活动的 Apple Watch 上应触发触觉警报,告诉用户计时器已结束。
我这样做是因为一旦手表处于非活动状态,计时器就不会继续在 Apple Watch 上运行。
我面临的问题是:
a) 通知有时会显示在 iPhone 上而不是 Apple Watch 上(基于其他帖子,我担心这无法更改...)
b) 手表上没有触觉警报(纯粹显示通知,这仅在用户下次激活手表时,而不是在实际触发通知时)
func sendAwakeNotification(nextTime:NSDate) {
print("AppDelegate: - sendAwakeNotification")
dispatch_async(dispatch_get_main_queue()) { () -> Void in
let localNotification = UILocalNotification()
localNotification.fireDate = nextTime
localNotification.timeZone = NSTimeZone.defaultTimeZone()
localNotification.alertBody = "Finished Step"
localNotification.alertTitle = "Alert"
localNotification.soundName = UILocalNotificationDefaultSoundName
localNotification.category = "myTimer"
let userInfo: [NSObject : AnyObject] = [
"notification_id" : "myTimerNotification"
]
localNotification.userInfo = userInfo
UIApplication.sharedApplication().scheduleLocalNotification(localNotification)
}
}
Run Code Online (Sandbox Code Playgroud)
通知中的代码
override func …Run Code Online (Sandbox Code Playgroud) 我可以检查用户是否在iOS8之前授予了通知(警告)权限:
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types & UIRemoteNotificationTypeAlert)
{
//user granted
}
Run Code Online (Sandbox Code Playgroud)
它不适用于iOS8,它说:
iOS (3.0 and later) Deprecated:Register for user notification settings using the registerUserNotificationSettings: method instead.
Run Code Online (Sandbox Code Playgroud)
控制台说:
enabledRemoteNotificationTypes is not supported in iOS 8.0 and later.
Run Code Online (Sandbox Code Playgroud)
那么如何在iOS 8上查看呢?
deprecated push-notification apple-push-notifications ios ios8
ios ×3
ios8 ×2
swift ×2
alert ×1
apple-watch ×1
cocoa-touch ×1
deprecated ×1
estimote ×1
ibeacon ×1
local ×1
objective-c ×1
uialertview ×1
watchkit ×1
watchos-2 ×1
xcode ×1
xcode6 ×1