我总是在使用本教程部署firebase时编译错误:https://firebase.google.com/docs/cloud-messaging/ios/client 我的部署SDK是9.0.
我怎样才能解决这个问题?
无法指定"AppDelegate"类型的值来键入"UNUserNotificationCenterDelegate?"
AppDelegate中的代码:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// [START register_for_notifications]
if #available(iOS 10.0, *) {
let authOptions : UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_,_ in })
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self
// For iOS 10 data message (sent via …Run Code Online (Sandbox Code Playgroud) 我无法在UNNotificationServiceExtension中使用调试器.
这是我在尝试将调试器附加到UNNotificationServiceExtension时所做的事情:
有谁知道如何使调试器在UNNotificationServiceExtension中工作?
在“项目位置”选项上使用“填充”值时,如何删除标签栏项目之间的间距?
我尝试了以下方法:
let tabBarController = window!.rootViewController as! UITabBarController
tabBarController.tabBar.itemSpacing = 0
let numberOfItems = CGFloat(tabBarController.tabBar.items!.count)
let tabBarItemSize = CGSize(width: tabBarController.tabBar.frame.width / numberOfItems, height: tabBarController.tabBar.frame.height)
tabBarController.tabBar.selectionIndicatorImage = UIImage.imageWithColor(color: UIColor.secondaryHighlight(), size: tabBarItemSize).resizableImage(withCapInsets: UIEdgeInsets.zero)
for item in tabBarController.tabBar.items! {
item.imageInsets = UIEdgeInsetsMake(0, 0, 0, 0)
}
extension UIImage {
class func imageWithColor(color: UIColor, size: CGSize) -> UIImage {
let rect: CGRect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
UIGraphicsBeginImageContextWithOptions(size, false, 0)
color.setFill()
UIRectFill(rect)
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
return image …Run Code Online (Sandbox Code Playgroud)