我正在尝试将我的应用程序连接到firebase以发送通知,但是我有一个错误:
"_OBJC_CLASS_$_FIRApp", referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
普通能力中的没有任何错误。 在代码中同样没有任何错误但是当我构建并运行时出现此错误。 在创建证书的同时,也没有任何错误。 Here is how the errror is look like 。请帮忙!
以下是我写的代码:
//
// AppDelegate.swift
// COAP
//
// Created by Azamat Bolegenov on 23.05.17.
// Copyright © 2017 Azamat Bolegenov. All rights reserved.
//
import UIKit
import CoreData
import FirebaseCore
import FirebaseMessaging
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.alert, UIUserNotificationType.badge, UIUserNotificationType.sound]
let notificationSettings = UIUserNotificationSettings(types: notificationTypes, categories: nil)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(notificationSettings)
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
print("MessageID:: \(userInfo["gcm_message_id"]!)")
print(userInfo)
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
答案 0 :(得分:1)
转到构建设置>其他链接器标志>在新行$(继承)。
执行Cmd + Ctrl + K进行清理,然后构建