我在iOS上运行应用时遇到问题。 日志有一个警告:
尝试标记应用程序图标但尚未获得用户的许可以标记应用程序
虽然,我正在函数didFinishLaunchingWithOptions()
上运行代码。这是我的代码:
UIApplication* application = [UIApplication sharedApplication];
//-- Set Notification
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
// iOS 8 Notifications
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[application registerForRemoteNotifications];
}
else
{
// iOS < 8 Notifications
[application registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
请给我一些建议来解决这个问题。非常感谢您帮助解决问题。
答案 0 :(得分:0)
您需要了解用户是否已授予权限(在“设置”中),以便您通过调用public static void main(String[] args) {
Scanner in = new Scanner(System.in);
List<Double> inputs = getALInfo(in);
int lowNum = getLowestnum(in);
double average = calculateAvg(inputs, lowNum);
System.out.printf("%.2f%n", average);
}
通过徽章进行通知。如果没有,请勿尝试使用徽章。