I spent a lot of time trying to solve that issue myself and already double checked available answers on SO with the same error. So here are the list of thing that I already excluded from possible reasons:
project.pbxproj
files (from my original project and fresh test project) using comparison tool to find some differences in project settings, all the sameWhen I go to the Report Navigator and look for each file which wasn't compiled successfully, I found some weird correlation: any file that use some of the API of NSString
fails to compile. To prove that assumption I found some file which was compiled successfully and added there the following line of code
let abc = NSString(string: "abc")
and then this file stops to compile too.
So for some files it says that casting String
class object with as NSString
is invalid, somewhere NSAttributedString
/NSString
creation fails, in some other places calling compare
or rangeOfString
was incorrect etc. But when I copy pasted all that pieces of code that caused Segmentation fault
error to my new fresh project, they compiled successfully
And of course, that project was compiling fine using Xcode 6 just one day ago
I don't know where to go from here and how to fix that issues, any help will be very useful
UPD
I uploaded the project that doesn't compile to the GitHub
1) Segmentation Fault (also known as SIGSEGV and is usually signal 11) occur when the program tries to write/read outside the memory allocated for it or when writing memory which can only be read.In other words when the program tries to access the memory to which it doesn't have access to.
ANSWER. Signal 11, or officially know as "segmentation fault", means that the program accessed a memory location that was not assigned. That's usually a bug in the program. So if you're writing your own program, that's the most likely cause.
Segmentation fault 11 Python Segmentation fault 11 is usually caused by memory allocation issues, and if you're having this problem, be sure to try some of the solutions mentioned above. Related articles. PS Store browser not supported error [Quick fix] The code execution cannot proceed because DLL was not found.
In "MYHelpers.h/.m" of your project (presumably from https://github.com/AlexandrGraschenkov/MYHelpers)
a NSString
category with some utility methods is defined:
#pragma mark - NSString+Utils
@interface NSString (Utils)
- (NSString *)trim; // trim whitespace characters with new line
- (NSString *):(NSString *)appendString;
- (NSURL *)toURL;
- (NSString *)URLEncodedString;
- (NSString *)URLDecodedString;
- (NSString *)lightURLEncodeString;
+ (BOOL)emailValidate:(NSString *)email;
- (CGSize)sizeForStringWithFont:(UIFont *)font constrainedToSize:(CGSize)size;
- (id)JSON;
@end
The second method
- (NSString *):(NSString *)appendString;
has an empty selector name. This is allowed in Objective-C, and you can call the method with
NSString *foobar = [@"foo" :@"bar"];
(I don't know if the method was intentionally defined with an empty selector name – I wouldn't recommend it.)
But it causes the Swift compiler to crash. This happens only if NSString
is referenced somewhere in the Swift code.
(The compiler should never crash, no matter how malformed the input is,
so I would recommend to file a bug report at Apple).
You can rename the method to
- (NSString *)appendString:(NSString *)appendString;
(or simply remove it if you don't need it in your project), that should solve the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With