如何在Swift中正确地初始化Fabric
文档中显示了两种不同的初始化方法:
A)从这里开始
Fabric.with([Crashlytics.self(), Answers.self()])
B)从这里
Fabric.with([Crashlytics.self, Answers.self])
C)这也不会让编译器抱怨
Fabric.with([Crashlytics.self, Answers.self()])
D)从哪里来
Fabric.with([Crashlytics(), Answers()])
据我所知,A和D是相同的。 但是B得到一个Type
数组。 哪一个是正确的? 如果它们不相同,它是如何工作的?
假设您使用构build脚本来设置Fabric,则会在您的项目的info.plist中放置相应的consumerKey和consumerSecret。
你可以用这个方法初始化Fabric:
迅速:
import Fabric import Crashlytics func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { Fabric.with([Crashlytics()]) //... your initialization code return true }