2015-07-21 77 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