Embedded Content Contains Swift Code with Xcode 8 Beta - objective-c

I am developing a command line macOS application(with Objective-C) which uses other 3rd party Swift libraries. I am retrieving an error says
"dyld: Library not loaded: #rpath/libswiftAppKit.dylib"
Previous answers recommend to set "Embedded Content Contains Swift Code" flag to true. However, this flag is missing with Xcode 8 beta.
I have tried "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", which i believe a new flag for Xcode 8. It doesn't work either :(
Is anyone tried to compile and execute a command line application with Xcode 8 beta that is;
- developed using Objective-C
- having 3rd party swift library dependencies
Update:
I ended up copying everything under "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx" into the folder where the executable stands. Not a perfect solution but it works.

Check this mentioned in Xcode 8 beta 2 Release Notes:
The new build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES replaces the use of EMBEDDED_CONTENT_CONTAINS_SWIFT. This setting indicates that Xcode should always embed Swift standard libraries in a target for which it has been set, whether or not the target contains Swift code. A typical scenario for using this setting is when a target directly uses or embeds another product which contains Swift code.
Note: EMBEDDED_CONTENT_CONTAINS_SWIFT has been deprecated. (26158130).

Related

In a static library, Xcode 8.1 does not detect when an objective-c method is not implemented

My objective-c project uses a static library and recently I just discovered that Xcode 8.1 does not give some warnings for the library.
When a method implementation is missing in the app itself, I get a warning. But if a method implementation is missing in the library, I get no warning. It just crashes at run time.
Same for the switch statement with an enum. If a case is missing, Xcode would signal a warning, but not in the static library.
In previous versions of Xcode, I am sure I received those warnings in my library. And I never changed any Build Settings, I just keep all the default values.
More info:
When I open the static library itself as a project, I get all warnings. But when I open another project that includes the library (I dropped the mylibrary.xcodeproj file in my project and add it in the Link phase), I don't have the library warnings
It was a bug in Xcode. It is now working well in Xcode Version 8.3 (8E162)

Use Legacy Swift Language Version

I am using Swift libraries in Objective-C Project with CocoaPods.
I tried running them in the recently released Xcode 8 GM and I am getting the following error:
I tried all the solutions in the below link and also from other SO Answers but nothing seems to work.
http://www.ios-blog.co.uk/tutorials/xcode/quick-tip-fix-use-legacy-swift-issue-in-xcode-8-beta-3/
Libraries I am using are Charts and XLPagerStrip.
You need to update your "Pods" project. For each Pod, choose the target and set it to use the legacy compiler. Note that if you do a "pod install" later, the workspace that gets generated will overwrite the legacy compiler settings, so you have to redo them.

Xcode 8 Objective-C project build error: “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly

I've just updated my Xcode from 7.31 to 8.
I have an Objective-C project that uses cocoapods.
When I double-clicked on xcworkspace file, it gave me error like:
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly."
So I opened Build Settings for the project and pod proj, but I still can't find any options named "Use Legacy Swift Language".
I looked over some articles about this, so I tried to set this flag to NO or YES from undefined. but I can't find this option.

Xcode: how to build a static library project correctly?

This question will be easy for Xcode pros but for a MonoTouch developer it seems to be impossible to resolve. :-)
I'm using Xcode 4.5 and I want to target iOS 5.1 and above and iOS Simulator 5.1 and above.
I have a a library project here and it is coming with a prebuilt binary named "DemoLib" (no extension and it is 11MB in size). The library is a fat lib for Simulator and iOS 5.1+.
I can use that library without any problem.
However if I try to build the library myself, I end up with a "DemoLib.a" file (notice the extension and the size of 30MB). How can I get the same build result? What is a .a file compared to the file without extension?
I tried to build the project "for running", and "for archiving" in Xcode. Both results in the same 30MB .a file.
I was expecting some dropdown in Xcode where one could select "DEBUG" or "RELEASE" build and the latter one would create the smaller lib.
Of course I could never tell without seeing the framework's project file. Having said that, there is an excellent guide to creating and compiling iOS frameworks here: https://github.com/jverkoey/iOS-Framework
Using the above guide, you should be able to recreate your framework's project from scratch, add the files you have to it, and properly compile it.
Hope this helps! :)
Did it come with a Makefile? Create a new target, set the build settings of the target to what's in the Makefile, then set your project to depend on that new target.
A file with the .a is a static library, which means it depends on nothing external and all the code it needs is compiled inside it. I think no extension generally implies dynamic library, which means it'll depend on some dependencies being present on your system to link against. Maybe that's why the .a is so much bigger. I think Xcode will build static by default because iOS does not allow the use of dynamic libraries.
The dropdown for what to build is in your scheme. Command+shift+< to view your scheme. Within the scheme you can edit which environment each method of building will use.

Xcode force_load not working for simulator build

I am using Xcode 4 and LLVM 2 for a workspace which has two projects (A and B) in it. The main project (A) links against the binary of the other project (B) which builds a static library.
Project B contains categories so in order for it to link into A properly I set the ObjC and all_load linker flags. This however caused problems because some of our libraries that I use have symbols that should not be loaded so I tried to move over to using force_load specifically on the library file of project B.
-force_load $(TARGET_BUILD_DIR)/libB.a
This makes things work on the device however in the simulator the app crashes because categories from project B are not being linked in.
Any idea why force_load works differently on device and simulator?
Let me know if you need more details.
Try -Wl,-force_load,$(TARGET_BUILD_DIR)/libB.a; IIRC, it's a known issue that Apple LLVM Compiler 2.0 doesn't honor -force-load.