【发布时间】:2018-12-08 07:37:00
【问题描述】:
我在 Cordova 中有一个 iOS 应用程序,它使用 OneSignal 实现了推送通知。
我已按照here给出的文档中的所有步骤进行操作
问题是,当我使用 XCode 安装应用程序时,应用程序会询问,
AppName 想给你发送通知
但在那之后一切都黑屏了。
我认为这是因为 AppDelegate.m 文件如下
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
//
// AppDelegate.m
// ReachApp
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import "AppDelegate.h"
#import "MainViewController.h"
#import <OneSignal/OneSignal.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Replace '11111111-2222-3333-4444-0123456789ab' with your OneSignal App ID.
[OneSignal initWithLaunchOptions:launchOptions
appId:@"11111111-2222-3333-4444-0123456789ab"
handleNotificationAction:nil
settings:@{kOSSettingsKeyAutoPrompt: @false}];
OneSignal.inFocusDisplayType = OSNotificationDisplayTypeNotification;
// Recommend moving the below line to prompt for push after informing the user about
// how your app will use them.
[OneSignal promptForPushNotificationsWithUserResponse:^(BOOL accepted) {
NSLog(@"User accepted notifications: %d", accepted);
}];
return YES;
}
@end
我也更换了身份证。并且在 XCode 日志中显示很少的警告,即
2018-06-29 12:33:16.661 ReachApp[721:311194] DiskCookieStorage 将策略从 2 更改为 0,cookie 文件: file:///private/var/mobile/Containers/Data/Application/4C0D3ECB-1F40-4668-BE78-AE1EF3CB7810/Library/Cookies/Cookies.binarycookies 2018-06-29 12:33:16.838 ReachApp[721:311194] 使用应用 ID 调用初始化: (null) 2018-06-29 12:33:16.934 ReachApp[721:311194] 调用初始化 应用 ID:Displays_Actual_App_ID_here 2018-06-29 12:33:17.019 ReachApp[721:311194] 警告:OneSignal 检测到您的 应用程序委托实现了一个不推荐使用的方法 (应用程序:didReceiveLocalNotification :)。请注意,这 方法已被正式弃用,OneSignal SDK 将不会 再叫它。您应该改用 UNUserNotificationCenter 2018-06-29 12:33:17.020 ReachApp [721:311194] 警告:OneSignal 有 检测到您的应用程序委托实现了不推荐使用的方法 (应用程序:handleActionWithIdentifier:forLocalNotification:completionHandler :)。 请注意,此方法已被正式弃用,并且 OneSignal SDK 将不再调用它。你应该使用 UNUserNotificationCenter 改为 2018-06-29 12:33:17.020 ReachApp[721:311194] 警告:OneSignal 检测到您的 应用程序委托实现了一个不推荐使用的方法 (应用程序:didReceiveLocalNotification :)。请注意,这 方法已被正式弃用,OneSignal SDK 将不会 再叫它。您应该改用 UNUserNotificationCenter 2018-06-29 12:33:17.028 ReachApp [721:311194] 警告:OneSignal 有 检测到您的应用程序委托实现了不推荐使用的方法 (应用程序:handleActionWithIdentifier:forLocalNotification:completionHandler :)。 请注意,此方法已被正式弃用,并且 OneSignal SDK 将不再调用它。你应该使用 改为 UNUserNotificationCenter
【问题讨论】:
标签: ios objective-c onesignal