Xcode swift failed with exit code 254

前端 未结 7 2284
灰色年华
灰色年华 2021-02-07 14:14

I am getting this compiler error in my code and I can\'t figure out why:

:0: error: unable to execute command: Segmentation fault: 11


        
7条回答
  •  旧巷少年郎
    2021-02-07 14:34

    In my case, i was calling an objective-c function from swift through bridge. Signature was like -

        - (SomeReturnType *)getSomething:(SomeOptions *)options
                              success:(void (^)(NSArray *response))success
                              failure:(void (^)(NSError *error))failure;
    

    From swift, i was calling it as follows and getting compile error as "Xcode swift failed with exit code 254" -

        ObjCClass().getSomething(nil, success: {(response : Array!) in
    
    
            }, failure: {(error: NSError!)  in
    
            })
    

    changing it to following worked for me -

         ObjCClass().getSomething(nil, success: {(response : [AnyObject]!) in
    
    
            }, failure: {(error: NSError!)  in
    
            })
    

提交回复
热议问题