Swift 011.c

0 views
Skip to first unread message

Jan Dominquez

unread,
Aug 5, 2024, 3:15:06 AM8/5/24
to landgibbaxi
Youcan get this error when the compiler gets too confused about what's going on in your code. I noticed you have a number of what appear to be functions nested within functions. You might try commenting out some of that at a time to see if the error goes away. That way you can zero in on the problem area. You can't use breakpoints because it's a compile time error, not a run time error.

2. Then I look at that function and commented out all of it. I compiled and it now worked. Then I removed the comments from parts of the function at a time, until I hit the line that was responsible for the error. After this I was able to fix it, and it all works. :)


For anyone else coming across this... I found the issue was caused by importing a custom framework, I have no idea how to correct it. But simply removing the import and any code referencing items from the framework fixes the issue.


I guess I got a little over-excited using the map function there... The new version is a lot simpler and also more human comprehensible. Still the compiler shouldn't crash. At worst it should show some errors. The code as is worked in Swift 1.x


When I got this error converting from Swift to Swift 2.0, it clearly indicates a particular file (blahClass.swift) that has the problem, then it outlined all of the warnings & errors in the error message text. I went through and resolved these manually and now the app compiles fine.


I have same problem so I tried switch Optimization Level to Fast, Single-File Optimization[-O] instead of Fast, Whole Module Optimization then it worked, built, archive to Appstore succeed.


The problem was that when I have added superclass to it, I forgot to also implement init. So that super.init caused compiler error Segmentation fault: 11So if you have such problem it's good idea to check also any superclasses.


After developing the framework for months and integrating it into a main project with intermixed Obj-C and Swift, importing to Obj-C was a no-problem, but as soon as I wrote the import MySwiftProject in Swift, all hell broke loose.


I also ran into this problem.... obviously, it is a general error or sorts... when the xcode gets confused.... in my case, I had 3 vars that I was assigning values to from an array.... but I did not specify the type of data in each element of the array.... once I did, it resolved the problem....


In my case it was caused by trying to use a function that returned an NSNumber as an argument where a Double was expected. My advice is be careful mixing Objective C objects with Swift datatypes. And as many others have suggested, comment out lines until you pinpoint which one causes the error. (Even if you create other errors when doing so, you can just ignore them and see what makes the segmentation fault error go away.)


I got segmentation fault on my Mac Mini using Xcode Bots. The seg fault did only occur during build step of testing and not during building or running locally. Only in Xcode bots during build step of testing.


I try to integrate Swift code in my app.My app is written in Objective-C and I added a Swift class. I've done everything described here. But my problem is that Xcode haven't created the -Swift.h file, only the bridging headers. So I created it, but it's actually empty.I can use all my ObjC classes in Swift, but I can't do it vice versa. I marked my swift class with @objc but it didn't help. What can I do now?


I spent about 4 hours trying to enable Swift in my Xcode Objective-C based project. My myproject-Swift.h file was created successfully, but my Xcode didn't see my Swift-classes. So, I decided to create a new Xcode Objc-based project and finally, I found the right answer! Hope this post will help someone :-)


In my sample I use SwiftCode.h to detect Swift code in Objective-C. This file generate automatically (I did not create a physical copy of this header file in a project), and you can only set name of this file:


I had the same issue and it turned out special symbols in the module name are replaced by xcode (in my case dashes ended up being underscores). In project settings check "module name" to find the module name for your project. After that either use ModuleName-Swift.h or rename the module in settings.


The file is created automatically (talking about Xcode 6.3.2 here). But you won't see it, since it's in your Derived Data folder. After marking your swift class with @objc, compile, then search for Swift.h in your Derived Data folder. You should find the Swift header there.


I had the problem, that Xcode renamed my my-Project-Swift.h to my_Project-Swift.h Xcode doesn't like"." "-" etc. symbols. With the method above you can find the filename and import it to a Objective-C class.


The last point (5) was crucial. I put it only on the second section (Targets field), the Project field should be left empty: Otherwise, it did not generate the right "Project-Swift.h" file for me (it did not include swift methods).


I had the same problem and finally it appeared that they weren't attached to the same targets. The ObjC class is attached to Target1 and Target2, the Swift class is only attached to the Target1 and is not visible inside the ObjC class.


When you add new Swift files to the project, please, make sure that you add them to correct targets.Please, make sure that every swift file you're going to use inherits NSObject class and annotated with @ObjCMembersChange to YES inside the build settings under the option ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES.Change to YES inside the build settings under the option DEFINES_MODULE.


If you are going to import code within an App Target (Mixing Objective-C and Swift in one project) you should use the next import line #import "-Swift.h" to expose Swift code to Objective-C code [Mixing Swift and Objective-C code in a project]


I have the same error: myProjectModule-Swift.h file not found", but, in my case, real reason was in wrong deployment target:"Swift is unavailable on OS X earlier than 10.9; please set MACOSX_DEPLOYMENT_TARGET to 10.9 or later (currently it is '10.7')"so, when I've changed deployment target to 10.9 - project had been compiled successfully.


My issue was that the auto-generation of the -swift.h file was not able to understand a subclass of CustomDebugStringConvertible. I changed class to be a subclass of NSObject instead. After that, the -swift.h file now included the class properly.


So in all my objective-c classes that use swift, but are also bridged, the key was to make sure that you use forward class declarations in the headers, then import the "*-Swift.h" file in the .m file.


well, after reading all the comments and trying and reading and trying again, I managed to include swift classes into my Big obj-c project.So, thanks for all the help.I wanted to share one tip that helped me understand the process better.In the .m class, went to the import line of the swift target name #import "myTargetName-Swift.h"and clicked the key:


When I want to use an Swift inner class in a objc code, it does not compile for ther error "undefined symbol"(for bother inner class and outer class), I checked the generated "-swift.h" header and both classes are there.


I use CocoaPods and the Swift class from my library couldn't be located from the Objective-C code in the example app because it's project and target were named the same as the library, so I had to remove the Objective-C Generated Interface Name values so they didn't conflict with the ones from the library.


Hey, I've been trying to pinpoint what is causing this crash, but I'm having troubles understanding the Apple Crash log. I understand that this crash is happening after the app is launched, because I know we call canEvaluatePolicy() and evaluatePolicy() when the login screen finished loading. But if you notice, the following error lines after that are not related to LocalAuthentication (or so I think), therefore I'm confused.


APIGuard is a security framework that we use, it initializes every time application(_ application: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool is triggered. This framework is a black box, so I can't see what the initialize function is doing, but I will reach out to them and ask some questions. What makes you think that this could be the issue?


I have a similar issue, although not using APIGuard and making it slightly further in the [LAContext canEvaluatePolicy:error:] call before receiving a crash event. It's worth noting the crash is rare. I'll attach a crash report as well, but you can see the app has been running for about half a day (my logging tool shows the app crashed pretty quickly after coming back into the foreground).


For Authentication, I am using the open source library Auth0.swift Version 2.1.0. The crashing line can be found here on GitHub for context, but I don't see how it could result in a crash at this time.

3a8082e126
Reply all
Reply to author
Forward
0 new messages