Xcode compile error on Release Build on a project that uses some framework reference - swift

I am working on a Swift project that uses some frameworks references. It works well when the debug compile. But, When I compile Release it throwing some reference errors like below;
That failed classes are in the CryptoSwift.framework library and MyFramework using this library. CryptoSwift.framework existing on build phases.
I tried "Optimization Level -> None [-Onone]" but failed.
Swift Version: 2.3,
Xcode Version: 8.0

It worked after I selected "Build Active Architecture Only" for Release Compile.
The reason for the error is that the frameworks do not support all architectures.

Related

Bundle all local transient Swift Packages into a single xcframework

I am developing a SDK and use SPM to modularise my code. All code is written in Swift.
My project structure is like this:
SampleApp (Workspace) -> SDK (SPM) -> ModuleA (SPM)
I can build and run the sample app locally successfully.
Now I want to archive/build the SDK package into a dynamic xcframework that my other clients can just drag and drop into their Xcode to consume.
I'm using xcodebuild -create-xcframework for that purpose and can successfully build a sdk.xcframework file.
But in a separated sample app where I embed the sdk.xcframework there, when import SDK module, I get this error
No such module 'ModuleA'
Failed to build module 'SDK' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
I assume here, this is because the compiler can't find ModuleA
Is there anyway that I can bundle the ModuleA into sdk.xcframework statically, so that my clients can just drag only sdk.xcframework into their projects to consume the SDK module?
The question is pretty much: How can I bundle ModuleA and SDK into a single .xcframework for distribution

error: unresolved reference: mongodb in Kotlin

I am new to Kotlin. I want to perform basic CRUD operations with Mongo DB and I get the following error:
error: unresolved reference: mongodb
for this line of code:
import com.mongodb.BasicDBObject
I have added the following dependency in the build of the module in Android Studio (Intellij IDE).
implementation 'org.mongodb:mongodb-driver-sync:3.11.0'
What am I missing?
EDIT
This is the project hierarchy. I work with DBOps.kts
I think you are using legacy code.
Here is the correct one for that.
dependencies {
compile 'org.mongodb:mongo-java-driver:2.13.3'
}
Reference : https://mongodb.github.io/mongo-java-driver/2.13/getting-started/installation-guide/
EDIT
I have tried myself, and it works, so I guess there is another issue.
After importing library via Gradle, you could check it is imported correctly from Project -> External Libraries(Check below image)
If you cannot see the MongoDB library from there, there is a possibility that IDE has some problems. So I would recommend reset caches(File -> Invalidate Caches / Restart), clean build, and rebuild the project.

Satisfying a framework's dependencies while within another project

I am working on an iOS framework. My development environment is an iOS application project with the framework project within it, the framework's product is then added to the "Embedded binaries" and "Linked Frameworks and Libraries" sections of the application.
The previous setup works fine, but this particular framework I'm working on requires one other framework to function. I have installed this framework via Carthage and added it to the base application's project ("Embedded binaries" and "Linked Frameworks and Libraries") and then also the framework's project "Linked Frameworks and Libraries".
However when I run the application I get the following two errors (FrameworkOne is the framework I'm working on in a project, FrameworkTwo is the dependency):
dyld: lazy symbol binding failed: Symbol not found:
[symbol here]
Referenced from:
[path to iOS sim]/FrameworkOne.framework/FrameworkOne
Expected in:
[path to application]/Frameworks/FrameworkTwo.framework/FrameworkTwo
...and...
dyld: Symbol not found:
[symbol here]
...the same paths as above...
What am I doing wrong here?
The answer is simple and frustrating in hindsight: the version of the framework used within my application project and my framework project didn't match.
If you're having similar issues check that your application and framework are using the same version!

Cocoapods SwiftWebSocket in Xcode project - library is not found

I'm experimenting with SwiftWebSocket in Swift using Xcode 10.1.
I've added the pod via this podfile:
platform :osx, '10.14'
target 'ViewWebSocketLearning' do
use_frameworks!
pod 'SwiftWebSocket', '~> 2.7'
end
and I've loaded the pod as follows:
$ pod install
Analyzing dependencies
Downloading dependencies
Using SwiftWebSocket (2.7.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
which produces a workspace with the SwiftWebSocket project included in it. I compiled the projects and you can see that it is correctly compiling both my empty project and the SwiftWebSocket project properly. Everything is looking good so far.
However as soon as I try to include a reference to the SwiftWebSocket project in my project's unit tests, Xcode chokes. Here's a snip of my code:
import SwiftWebSocket
...
let ws = WebSocket("wss://echo.websocket.org")
I get "No such module 'SwiftWebSocket'". If I take out the import, I get "Use of unresolved identifier 'WebSocket'". So something isn't linking properly by the looks of it.
I've tried adding the compiled framework from the SwiftWebSocket project to mine in the project organizer on the left, no change. I've added it to the Linked Frameworks and Libraries in the target settings, again no change.
What am I missing?
I'm a relative novice to Xcode so apologies but I really would like to get past this point so your help is much appreciated! Thank you.
It's not exactly the solution I was shooting for, but I solved this by building a class in my project which contains the logic to control the SwiftWebSocket, then called that class from inside the unit tests.
Architecturally this is probably cleaner but I remain unclear on why I couldn't access the SwitfWebSocket directly from the unit tests.

Scala Compiler doesn't compile in ScalaIDE

I'm trying to develop on the Scala compiler project with the help of ScalaIDE. I followed this guide to set up the development environment. When I now try to build the mentioned projects, the reflect project won't get built. Instead, I get the following error via the console output:
uncaught exception during compilation: scala.reflect.internal.MissingRequirementError reflect Unknown Scala Problem
Having tried the provided ANT script of the project via the console, everything seems to work fine.
Does anyone know if I'm missing a hidden compiler flag, dependency or something like this?
Thanks!
With the IDE for Scala 2.10 you can only build the 2.10.x branch of the Scala compiler. If you want to work on master, you need to install a 2.11-based version of the IDE. We don't publicise IDE for 2.11 nightlies yet, but they are available at:
http://download.scala-ide.org/nightly/scala-ide-master-2.11.0-SNAPSHOT/