2015-07-21 79 views
2

我需要帮助如此糟糕。Swift解析/ FaceBookSDK崩溃

我一直在这里用swift进行编程,但我似乎无法找到以前有过这个问题的人。

让我来描述一下这个问题: 每当我尝试运行我的应用程序时,它会在AppDelegate中崩溃,在第一行使用“SIGABRT”。理事会说“'PFUser类在使用Parse之前必须先使用registerSubclass注册。'”,由于我没有对远程接触PFUser的任何东西进行分类,所以我完全不知所措。

我认为这件事情做的FacebookSDK(4.something,最新的7月2日),我一直在努力整合,但即使当我从项目的事中删除它仍然打破。也可能与我刚刚更新Parse到1.7.5有关,但我真的不知道了。

这是我已经试过

  1. 清洗,改造,重新启动等
  2. 进口解析与“导入解析”在App代表中,而不是用头桥。
  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> 

任何帮助将是惊人的!

感谢,

-MacLean

回答

1

所以事实证明,有解析1.6和1.7这是造成此故障的整个之间的问题时间。我错误地宣布了一个PFUser变量,并不知道。解析1.7关心,其中1.6没有。我不知道这可能有什么不同,并且认为它与facebook SDK(我有多专业)有关。

作为罪魁祸首的代码是var currentUser:PFUser = PFUser(),我可以自由编辑。我希望这可以帮助那里的人找出解析!

1

与最新的SDK,以我的经验,你实际上并不需要桥接头,并加入到软件开发工具包将有实际上导致问题!因此,尝试从标题中你使用他们在课堂上取出并用进口。

import Parse 
import FBSDKCoreKit 
import FBSDKLoginKit 
+0

仍然没有运气,谢谢吨虽然!仍然使用“'PFUser类必须在使用Parse之前向registerSubclass注册”。任何其他想法? – MQLN