gpt4 book ai didi

ios - Parse/FaceBookSDK 使用 Swift 崩溃

转载 作者:可可西里 更新时间:2023-11-01 01:39:28 26 4
gpt4 key购买 nike

我非常需要帮助。

我在这里用 swift 编程有一段时间了,但我似乎找不到以前遇到过这个问题的人。

让我描述一下问题:每当我尝试运行我的应用程序时,它都会在 AppDelegate 中崩溃,就在第一行出现“SIGABRT”。理事会说“‘PFUser 类必须在使用 Parse 之前使用 registerSubclass 注册。’”,这让我完全不知所措,因为我没有对任何远程接触 PFUser 的东西进行子类化。

我认为这与我一直试图集成的 FacebookSDK(4.something,截至 7 月 2 日的最新版本)有关,但即使我将其从项目中删除,事情仍然存在。也可能与我刚刚将 Parse 更新到 1.7.5 的方式有关,但我真的不知道了。

这是我尝试过的

  1. 清理、重建、重启等
  2. 在 App Delegate 中使用“Import Parse”导入解析,而不是使用头桥。
  3. 多次重新安装所有框架。
  4. 更改 didFinishLaunchingWithOptions 中的顺序

这是我的代码:

import UIKit
import iAd
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



var window: UIWindow?
var UIiAd: ADBannerView = ADBannerView()


func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]!) -> Bool {

Parse.setApplicationId("2NFm7aqXQIdO0JCaxH8bwveJhRhV5iEGQWDVpDgO", clientKey: "jIhPRyAXdUVnKuFh7ka7OAQjp2pcVi0LB2WWNXcg")

PFAnalytics.trackAppOpenedWithLaunchOptionsInBackground(launchOptions, block: nil)

GMSServices.provideAPIKey("AIzaSyAM5ff80Oc-1n9UJV1wZjX6ElFP-6PD2eI")

FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)



FBSDKLoginManager.renewSystemCredentials { (result:ACAccountCredentialRenewResult, error:NSError!) -> Void in }




PFPurchase.addObserverForProduct("kinkstrtext.addevent") {
(transaction: SKPaymentTransaction?) -> Void in
println("purchased");
}

let notificationTypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound

if application.respondsToSelector("isRegisteredForRemoteNotifications")
{
// iOS 8 Notifications

let notificationSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories:nil)


UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
}
else
{
// iOS < 8 Notifications
application.registerForRemoteNotificationTypes(.Badge | .Sound | .Alert)

}


var navigationBarAppearace = UINavigationBar.appearance()

var btnColor:UIColor
btnColor = UIColor(red: 0.99, green: 0.99, blue: 1, alpha: 1)
var barColor:UIColor
barColor = UIColor(red: 0.706, green: 0.506, blue: 0.678, alpha: 1.0)
var titleColor:UIColor
titleColor = UIColor(red: 0.99, green: 0.99, blue: 1, alpha: 1)

UIApplication.sharedApplication().statusBarStyle = .LightContent


navigationBarAppearace.tintColor = btnColor // Back buttons and such
navigationBarAppearace.barTintColor = barColor // Bar's background color

navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:titleColor] // Title's text color

return true
}

func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {

UIApplication.sharedApplication().registerForRemoteNotifications()

}

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {

let currentInstallation:PFInstallation = PFInstallation.currentInstallation()
currentInstallation.setDeviceTokenFromData(deviceToken)
currentInstallation.saveInBackground()

}

func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {

println(error.localizedDescription)

}

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {

NSNotificationCenter.defaultCenter().postNotificationName("getMessage", object: nil)

}

func applicationWillResignActive(application: UIApplication) {
}

func applicationDidEnterBackground(application: UIApplication) {
}

func applicationWillEnterForeground(application: UIApplication) {
}

func applicationDidBecomeActive(application: UIApplication) {
FBSDKAppEvents.activateApp()
}

func applicationWillTerminate(application: UIApplication) {
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}

这是我的标题:

#import <Parse/Parse.h>
#import <ParseFacebookUtilsV4/PFFacebookUtils.h>
#import <Bolts/Bolts.h>

#import <GoogleMaps/GoogleMaps.h>

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

任何帮助都会很棒!

谢谢,

-麦克莱恩

最佳答案

使用最新的 SDK,根据我的经验,您实际上不需要桥接头,将 SDK 添加到那里实际上会导致问题!因此,请尝试从 header 中删除它们并在您正在使用它们的类中使用导入。

import Parse
import FBSDKCoreKit
import FBSDKLoginKit

关于ios - Parse/FaceBookSDK 使用 Swift 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31530102/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com