由于信号命令失败:分段错误:11

时间:2017-02-06 08:03:54

标签: ios iphone swift xcode swift3

在编译我的项目时,我继续收到此错误,有时我的项目运行顺利但有时xcode显示此错误。我还添加了AddMembersViewController.swift,我认为这会导致问题

MergeSwiftModule normal x86_64 /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous.swiftmodule
    cd /Users/prakhar/Desktop/iOS/Rendezvous
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/MoreViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/HomePageViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/RegisterViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/LocationSelectorViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/AddMembersViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/SetupViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/ViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/UpdateViewController~partial.swiftmodule -parse-as-library -target x86_64-apple-ios10.1 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -I /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Products/Debug-iphonesimulator -F /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Products/Debug-iphonesimulator -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseAnalytics/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseAuth/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseCore/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseDatabase/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseInstanceID/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleInterchangeUtilities/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleMaps/Base/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleMaps/Maps/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GooglePlaces/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleSymbolUtilities/Frameworks/frameworks -enable-testing -g -import-objc-header /Users/prakhar/Desktop/iOS/Rendezvous/Rendezvous/Rendezvous-Bridging-Header.h -module-cache-path /Users/prakhar/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-generated-files.hmap -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-own-target-headers.hmap -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-all-target-headers.hmap -Xcc -iquote -Xcc /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-project-headers.hmap -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Firebase/Core/Sources -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/Firebase -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseAnalytics -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseAuth -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseCore -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseDatabase -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseInstanceID -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GTMSessionFetcher -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleInterchangeUtilities -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleMaps -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GooglePlaces -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleSymbolUtilities -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleToolboxForMac -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/DerivedSources/x86_64 -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/prakhar/Desktop/iOS/Rendezvous -emit-module-doc-path /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous.swiftdoc -module-name Rendezvous -emit-objc-header-path /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous-Swift.h -o /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous.swiftmodule

0  swift                    0x000000010fd283ad PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x000000010fd27b56 SignalHandler(int) + 790
2  libsystem_platform.dylib 0x00007fffd1db0bba _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff52f3aba8 _sigtramp + 2165874696
4  swift                    0x000000010d334996 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 806
5  swift                    0x000000010d32d178 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 18664
6  swift                    0x000000010d338b2c swift::ModuleFile::maybeReadPattern() + 332
7  swift                    0x000000010d32bd82 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 13554
8  swift                    0x000000010d33d4a7 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
9  swift                    0x000000010d6d006a (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 314
10 swift                    0x000000010d6ce01b (anonymous namespace)::Traversal::doIt(swift::Decl*) + 219
11 swift                    0x000000010d085c2f swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1423
12 swift                    0x000000010d08acef swift::runSILDiagnosticPasses(swift::SILModule&) + 159
13 swift                    0x000000010cd34f7e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 19758
14 swift                    0x000000010cd2e2b3 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17859
15 swift                    0x000000010ccea5cf main + 8239
16 libdyld.dylib            0x00007fffd1ba3255 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/MoreViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/HomePageViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/RegisterViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/LocationSelectorViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/AddMembersViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/SetupViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/ViewController~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/UpdateViewController~partial.swiftmodule -parse-as-library -target x86_64-apple-ios10.1 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -I /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Products/Debug-iphonesimulator -F /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Products/Debug-iphonesimulator -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseAnalytics/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseAuth/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseCore/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseDatabase/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/FirebaseInstanceID/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleInterchangeUtilities/Frameworks/frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleMaps/Base/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleMaps/Maps/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GooglePlaces/Frameworks -F /Users/prakhar/Desktop/iOS/Rendezvous/Pods/GoogleSymbolUtilities/Frameworks/frameworks -enable-testing -g -import-objc-header /Users/prakhar/Desktop/iOS/Rendezvous/Rendezvous/Rendezvous-Bridging-Header.h -module-cache-path /Users/prakhar/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-generated-files.hmap -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-own-target-headers.hmap -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-all-target-headers.hmap -Xcc -iquote -Xcc /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Rendezvous-project-headers.hmap -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Firebase/Core/Sources -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/Firebase -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseAnalytics -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseAuth -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseCore -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseDatabase -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/FirebaseInstanceID -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GTMSessionFetcher -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleInterchangeUtilities -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleMaps -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GooglePlaces -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleSymbolUtilities -Xcc -I/Users/prakhar/Desktop/iOS/Rendezvous/Pods/Headers/Public/GoogleToolboxForMac -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/DerivedSources/x86_64 -Xcc -I/Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/prakhar/Desktop/iOS/Rendezvous -emit-module-doc-path /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous.swiftdoc -module-name Rendezvous -emit-objc-header-path /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous-Swift.h -o /Users/prakhar/Library/Developer/Xcode/DerivedData/Rendezvous-ardcsmuqhgsylxapkcrnrtdcwvnu/Build/Intermediates/Rendezvous.build/Debug-iphonesimulator/Rendezvous.build/Objects-normal/x86_64/Rendezvous.swiftmodule 
1.  While loading members for 'AddMembersViewController' at <invalid loc>
2.  While deserializing decl #143 (PATTERN_BINDING_DECL)
3.  While deserializing decl #13 (VAR_DECL)

AddMembersViewController

@IBOutlet weak var eventName: UITextField!
    @IBOutlet weak var memberName: UITextField!
    @IBOutlet weak var addButton: UIButton!
    @IBOutlet weak var finishButton: UIButton!
    @IBOutlet weak var createButton: UIButton!
    @IBOutlet weak var timeAndDate: UIDatePicker!
    @IBOutlet weak var errorLabel: UILabel!
    @IBOutlet weak var tableView: UITableView!
    var rCoordinate:CLLocationCoordinate2D!
    var members:[String]=[]
    var ref = FIRDatabase.database().reference(withPath: "event-data")
    var refUser = FIRDatabase.database().reference(withPath: "user-data")
    var event:String = ""
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "members")
        memberName.isEnabled=false
        addButton.isHidden=true
        finishButton.isHidden=true
        let user = FIRAuth.auth()?.currentUser
        members.append((user?.displayName!)!)
        // Do any additional setup after loading the view.
    }
    @IBAction func cancel(_ sender: Any) {
        let alert=UIAlertController.init(title: "confirmation", message: "Are you sure you want to cancel", preferredStyle: UIAlertControllerStyle.alert)
        alert.addAction(UIAlertAction.init(title: "Yes", style: UIAlertActionStyle.default, handler: {(action:UIAlertAction!) in
            self.performSegue(withIdentifier: "home", sender: self)
        }))
        alert.addAction(UIAlertAction.init(title: "No", style: UIAlertActionStyle.cancel, handler: nil))
        self.present(alert, animated: true, completion: nil)
    }

    @IBAction func create(_ sender: Any) {
        eventName.isEnabled = false
        timeAndDate.isEnabled = false
        createButton.isHidden = true
        addButton.isHidden = false
        memberName.isEnabled = true
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func viewDidAppear(_ animated: Bool) {
        errorLabel.text=""
    }

    @IBAction func add(_ sender: Any) {
        errorLabel.text=""
        let newUser:String = memberName.text!
        for one in members{
            if(one == newUser){
                errorLabel.text="\(newUser) already added"
                return
            }
        }
        var flag=false
        refUser.observeSingleEvent(of: .value, with: {(snapshot) in
            let value=snapshot.value as! NSDictionary
            for val in (value.allKeys){
                //print(val)
                if(newUser == val as? String){
                    flag=true
                    break
                }
                //print("inside \(flag)")
            }
            if(flag){
                self.members.append(newUser)
                self.tableView.reloadData()
                self.memberName.text=""
                self.finishButton.isHidden=false
            }
            else{
                self.errorLabel.text="No such UserNAme found"
            }
        })

    }
    @IBAction func finish(_ sender: Any) {
        let event=eventName.text!
        if(members.count<2){
            let alert=UIAlertController.init(title: "No members added", message: "Add atleast one more member", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction.init(title: "Ok", style: UIAlertActionStyle.cancel, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
        let formatter=DateFormatter()
        formatter.dateFormat = "MMMM dd ,YYYY"
        let date = formatter.string(from: timeAndDate.date)
        formatter.dateFormat = "hh:mm a"
        let time = formatter.string(from: timeAndDate.date)
        ref.child("\(event)/latitude").setValue(rCoordinate.latitude)
        ref.child("\(event)/longitude").setValue(rCoordinate.longitude)
        ref.child("\(event)/date").setValue(date)
        ref.child("\(event)/time").setValue(time)
        ref.child("\(event)/noOfMembers").setValue(members.count)
        for i in 0..<members.count{
            ref.child("\(event)/member\(i)").setValue(members[i])
            refUser.child("\(members[i])/noOfEvents").observeSingleEvent(of: .value, with: {(snapshot) in
                var no = snapshot.value as! Int
                no += 1
                self.refUser.child("\(self.members[i])/noOfEvents").setValue(no)
                self.refUser.child("\(self.members[i])/event\(no)").setValue(event)
            })
        }
        let alert=UIAlertController.init(title: "Done", message: "Event created..!", preferredStyle: UIAlertControllerStyle.alert)
        alert.addAction(UIAlertAction.init(title: "Ok", style: UIAlertActionStyle.default, handler: {(action:UIAlertAction) in
            self.performSegue(withIdentifier: "home", sender: self)
        }))
        self.present(alert, animated: true, completion: nil)
    }

    public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return members.count
    }


    public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
        let cell=tableView.dequeueReusableCell(withIdentifier: "members", for: indexPath)
        cell.textLabel?.text=members[indexPath.row]
        cell.selectionStyle = .none
        return cell
    }

    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
        //let user = FIRAuth.auth()?.currentUser?.displayName
        if(editingStyle == UITableViewCellEditingStyle.delete){
            if(indexPath.row == 0){
                let alert=UIAlertController.init(title: "Error !!", message: "You cannot remove yourself..!", preferredStyle: UIAlertControllerStyle.alert)
                alert.addAction(UIAlertAction.init(title: "Ok", style: UIAlertActionStyle.cancel, handler: nil))
                self.present(alert, animated: true, completion: nil)
            }
            else{
                members.remove(at: indexPath.row)
                if(members.count < 2){
                    finishButton.isHidden = true
                }
                tableView.reloadData()
            }
        }
    }

    public func numberOfSections(in tableView: UITableView) -> Int{
        return 1
    }

1 个答案:

答案 0 :(得分:-1)

Command + Shift + K清除项目,然后按File-&gt;工作区设置 - &gt; DerivedData旁边的小箭头并删除文件夹。这有时可以解决问题。

另外,我注意到在Xcode 8.3 beta中,此问题已不再存在。