подфайл:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'Tx' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Tx
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod ‘Firebase/Database’
pod 'Firebase/Storage'
pod 'Firestore', :podspec => 'https://storage.googleapis.com/firebase-preview-drop/ios/firestore/0.7.0/Firestore.podspec.json'
end
AppDelegate:
import UIKit
import Firebase
import Firestore
import FirebaseAuth
import FirebaseDatabase
@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()
Auth.auth().signIn(withEmail: "1tester1@gmail.com", password: "1tester1")
{ (user, error) in
if let error = error
{
print ("Login failed \(error.localizedDescription)")
}else{
print ("Successful login")
}
}
return true
}
View Controller:
import UIKit
import Firebase
import Firestore
import FirebaseDatabase
import FirebaseStorage
class ViewController: UIViewController {
@IBOutlet weak var ptImage: UIImageView!
var db : Firestore! //Firestore
let storage = Storage.storage()
var dbRef : DatabaseReference! //FireBase
override func viewDidLoad() {
super.viewDidLoad()
fetchPtPic()
}//---------------
func fetchPtPic()
{
let TxPtID = "JJ"
db = Firestore.firestore()
dbRef = Database.database().reference()
let storageRef = storage.reference()
let ptImagesRef = storageRef.child("PtImages/\(TxPtID).jpg")
}
Он создает и завершает работу с SIGABRT перед выполнением чего-либо.Если я закомментирую эти строки:
//let storage = Storage.storage()
//var dbRef : DatabaseReference! //FireBase
и эти:
//dbRef = Database.database().reference() //points to the whole /
//let storageRef = storage.reference()
//let ptImagesRef = storageRef.child("PtImages/\(TxPtID).jpg")
... тогда он компилируется и выполняется чисто.
Предложения?Я пробовал много вещей и других предложений в течение 2 недель, и я в тупике.