iOS Question how can i integrate an xcframework written in swift?

ema01

Active Member
Licensed User
Longtime User
For context: a colleague has built a native ble library, to get around some limitations in the integrated one. He provided me with the LIBRARYNAME.xcframework, which contains ios-arm64 and ios-arm64_x86_64-simulator folders.

I placed the LIBRARYNAME.xcframework in a folder, and then pointed the "Additional libraries path" in B4i to that folder.

Now i'm trying to add it to a sample project.

I created a new project, i set the certificate and provision files to the appropriate one (our main certificate, our debug provisioning file) and it compiles.
I go to libraries, i don't see that as an external library.
I then add to the Main module using additional lib
B4X:
#AdditionalLib: LIBRARYNAME

but then i'm met with a wall of text
B4X:
B4i Version: 10.00
Parsing code.    (0.00s)
Building folders structure.    (0.03s)
Compiling code.    (0.01s)
Compiling layouts code.    (0.03s)
Compiling debugger engine code.    (1.01s)
Building Xcode project.    (0.42s)
Preparing project for builder.    (0.46s)
    Project size: 0.16 MB
Sending data to remote compiler.    Error
Error: security: SecKeychainDelete: The specified keychain could not be found.

Out: Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -configuration Release "PRODUCT_NAME=B4i Example" CONFIGURATION_BUILD_DIR=/Users/administrator/Documents/UploadedProjects/<user id>/Payload "CODE_SIGN_IDENTITY=iPhone Distribution: REDACTED" "OTHER_CODE_SIGN_FLAGS=--keychain <user id>" PROVISIONING_PROFILE=42176eb6-8579-43f0-89aa-cf48a6bf9e66 -arch arm64

Build settings from command line:
    ARCHS = arm64
    CODE_SIGN_IDENTITY = iPhone Distribution: REDACTED
    CONFIGURATION_BUILD_DIR = /Users/administrator/Documents/UploadedProjects/<user id>/Payload
    OTHER_CODE_SIGN_FLAGS = --keychain <user id>
    PRODUCT_NAME = B4i Example
    PROVISIONING_PROFILE = 42176eb6-8579-43f0-89aa-cf48a6bf9e66

note: Using codesigning identity override: iPhone Distribution: REDACTED
ComputePackagePrebuildTargetDependencyGraph

Prepare packages

CreateBuildRequest

SendProjectDescription

CreateBuildOperation

ComputeTargetDependencyGraph
note: Building targets in dependency order
note: Target dependency graph (1 target)
    Target 'B4iProject' in project 'B4iProject' (no dependencies)

GatherProvisioningInputs

CreateBuildDescription

[...]

ld: library 'LIBRARYNAME' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Error: ** BUILD FAILED **


The following build commands failed:
    Ld /Users/administrator/Documents/UploadedProjects/<user id>/Payload/B4i\ Example.app/B4i\ Example normal (in target 'B4iProject' from project 'B4iProject')
(1 failure)

using
B4X:
#AdditionalLib: LIBRARYNAME.xcframework
goes with a much smaller wall of text, but then "ld: library 'LIBRARYNAME.xcframework' not found"

I also tried copying the xcframework folder inside the project folder, alongside the B4i file.
What should have i done instead?
 

ema01

Active Member
Licensed User
Longtime User
What if i'm using the online build server? (we do have a mac now that is being left there unused though, and were thinking about making a local server)

Also, is there some documentation/tutorial for the AdditionalLib? I must be blind because i wasn't able to find what i was looking for
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If you want to create a B4i library, then you need to follow these steps: https://www.b4x.com/android/forum/threads/objective-c-writing-libraries-for-b4i.47024/
It requires a local Mac.

External frameworks can be accessed with #AdditionalLib + NativeObject + inline OBJC, however:
1. The framework needs to have an OBJC header.
2. The framework needs to be copied to the hosted or local builder.

I can help you with uploading the framework, however I'm pretty sure that a BLE library without a wrapper will not be useful.
What is missing in the iBLE library?
 
Upvote 0
Top