4

I was working in Xcode 9. Code was working fine but when I used same code in Xcode 10 then I am getting compile time error.

This is the error:

1.  While emitting SIL for 'fetchConsumerRecommendations(completionHandler:failureHandler:)' at /Users/shahezad/Desktop/Newcode/foodkonnectconsumer-ios/Food/FirebaseManager.swift:2578:5
2.  While silgen emitFunction SIL function "@$S4Food15FirebaseManagerC28fetchConsumerRecommendations17completionHandler07failureH0yySaySSGc_ys5Error_pSgctFZ".
 for 'fetchConsumerRecommendations(completionHandler:failureHandler:)' at /Users/shahezad/Desktop/Newcode/foodkonnectconsumer-ios/Food/FirebaseManager.swift:2578:5
3.  While silgen closureexpr SIL function "@$S4Food15FirebaseManagerC28fetchConsumerRecommendations17completionHandler07failureH0yySaySSGc_ys5Error_pSgctFZySo19FIRDocumentSnapshotCSg_AItcfU_".
 for expression at [/Users/shahezad/Desktop/Newcode/foodkonnectconsumer-ios/Food/FirebaseManager.swift:2584:285 - line:2615:9] RangeText="{ (documentSnapshot, error) in


            if error == nil {

                if (documentSnapshot?.exists)!{

                    print("Consumer Recommendations - \(describing: documentSnapshot?.data())")

                    let dictOnboarding:NSDictionary = (documentSnapshot?.data())! as NSDictionary

                    print("\(dictOnboarding.allKeys)")

                    completionHandler(dictOnboarding.allKeys as! [String])

                }
                else{


                    completionHandler([])

                }

            }
            else{

                failureHandler(error)

            }


        }"
error: Segmentation fault: 11

I am not able to figure out what this the problem with code.

ajeet sharma
  • 803
  • 10
  • 37

1 Answers1

0

Maybe someone in the future make my mistake in parsed json sorting like below:

let countryList = try? JSONDecoder().decode([Country].self, from: data)
   if let countryList = countryList {
         completion(countryList.sorted(by: <))
   }
Emre Değirmenci
  • 715
  • 6
  • 22