1

My problem is that I tried all solutions given for to solve this error, but I am not getting a proper solution.

In my case, sometimes when I clean my project and try to build it will work. but sometimes not. I also have set Enable BitCode to No.

Error While Building

After cleaning (Mac + Shift + K) (only works sometimes, not every time.)

same Project Build successfully

How do I fix this? I am using Firebase in my Project.

Edited: Older Version of this app is on AppStore and working perfect. The same error is also there, but it clears the review process of apple. Why am I getting this error?

CodeMouse92
  • 6,840
  • 14
  • 73
  • 130
Dhruv Khatri
  • 803
  • 6
  • 15
  • This happens often with the Swift compiler. Usually, it's because it's unable to infer a type, and blows its stack trying. – Avi Sep 12 '16 at 12:21
  • Often he source for the issue that's crashing the compiler is present in that greenish area of information, skim though it and see if there's some info available :) – donnywals Sep 12 '16 at 12:35
  • i tried to check out the green part but i didn't get anything @donnywals So how to solve it@Avi – Dhruv Khatri Sep 12 '16 at 12:50
  • Just so you know, "only sometimes" is typical with undefined behavior, which a segmentation fault is an example of. If the code is doing something for which no behavior is defined, it "is legal for the compiler to make demons fly out of your nose" (that is, cause anything to happen). It may work, it may throw a segfault, or it may dance on the rooftops in its knickers. – CodeMouse92 Sep 13 '16 at 15:07
  • So what's the solution for this. @CodeMouse92 – Dhruv Khatri Sep 13 '16 at 16:43
  • 1
    If I knew that, I would have answered. I'm not familiar enough with XCode to be able to diagnose this. I just wanted to share the information I did have. You'll need to trust that, as soon as someone knows the solution to this, they will answer. – CodeMouse92 Sep 13 '16 at 16:45
  • Thnx for the information @CodeMouse92 – Dhruv Khatri Sep 13 '16 at 16:47
  • By the way, have you seen [this](http://stackoverflow.com/questions/26557581/command-failed-due-to-signal-segmentation-fault-11?rq=1)? – CodeMouse92 Sep 13 '16 at 16:49
  • Yes i read this but I thought if other solution is possible and other thing is that sometimes it build. So i ask the question. @CodeMouse92 – Dhruv Khatri Sep 13 '16 at 17:09
  • Well, again, you have undefined behavior. The fact that you only get a segmentation fault *sometimes* doesn't differentiate your problem from that question. Have you looked into each any every answer there? (There are two pages of them). – CodeMouse92 Sep 13 '16 at 17:23
  • Yes i looked all but nothing can solve my problem – Dhruv Khatri Sep 13 '16 at 17:43
  • @DhruvKhatri Have you found the solution? I'm losing my health on constant dealing with that error – theDC Sep 17 '16 at 13:11
  • No didn't find solution in my code. but all my search results tell me that assign every variable type. not use direct AnyObject. but it didn't solve my problem.@DCDC – Dhruv Khatri Sep 17 '16 at 13:21

1 Answers1

0

Check your code somewhere you trying assign Inferred type to AnyObject.

Example:

let urlParameter = "FollowingUserID=" + followingId + "&FollowerUserID=" + self.userInfo![Constants.keyFollowerId]

userInfo is Swift Dictionary type. When i tried to concatenate compiler throws segmentation fault error.

splitting above code by typecasting the followerId.It succeeded compilation.

let followerId = self.userInfo![Constants.keyFollowerId] as? String
let urlParameter = "FollowingUserID=" + followingId + "&FollowerUserID=" + followerId!

Strictly type cast wherever you used AnyObject or not inferred type.