iOS Question trouble with external SDK

JordiCP

Expert
Licensed User
Longtime User
I need to use an existing IOS SDK into my app, but I am a bit confused about the steps to follow: I have read some posts but it is still unclear to me when a wrapper library is needed or when can it be used directly from inline Objective-C...

This is the platform: https://developer.mocaplatform.com
It is quite large, but I only need an initialization step and declare a callback to be called when a beacon is detected. So, I thought (wished!) that it could be solved using inline objectiveC


For this, I have tried to follow the instructions here: moca-ios-sdk-installation , so I do the following steps
  • Download the SDK and decompress it
  • Copy the .a and the various .h files to my local builder libs folder
  • Then, in my project, I try to just add a single call from inline objective-C
B4X:
#If OBJC

#import "MOCA.h"

- (void)MocaInit {
    [MOCA initializeSDK];
}
#end if

But the builder tells me that it doesn't find MOCA.h (it exists in the B4iBuildServer Libs folder)

Is this approach correct/possible? How should I proceed to use this SDK?
 

JordiCP

Expert
Licensed User
Longtime User
Now in the B4I code I have just added
B4X:
#AdditionalLib: MOCAlib      'also tried with libMOCALib, libMOCALib.a, MOCA
but the error remains the same.

The existing files in the SDK are libMOCALib.a, and some header files: MOCA.h, MOCAAction.h, ...
I have copied them all to the LocalBuilder Libs folder without any folder structure

I'm sure I'm missing/mixing some concepts yet.
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
I did it but have needed an additional step to make it work. Perhaps this gives a clue of something wrong configured in my mac

B4X:
#AdditionalJar: MOCALib       ' The .a file is "libMOCALib.a"

#if OBJC
#import "../../../Libs/MOCALib.h"        // <-- only worked with relative path of the libs folder respect to UploadedProjects folder
//#import "MOCALib.h"                      // <-- this didn't work
   
- (void)MocaInit {
   [MOCA initializeSDK];
}
#end if

Not tested yet since I need to setup other things, but now it compiles
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…