iOS Tutorial [Objective C] Writing libraries for B4i


Well-Known Member
Licensed User

Ju Yang

Active Member
Licensed User
hi, I follow the tutorial and make a lib, when I use it in B4I, I got a build error:

Ld Payload/ normal armv7
cd /Users/administrator/Documents/UploadedProjects/<user id>
export PATH="/Applications/"
/Applications/ -arch armv7 -isysroot /Applications/ -L/Users/administrator/Documents/UploadedProjects/<user id>/Payload -L../../Libs -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -filelist /Users/administrator/Documents/UploadedProjects/<user id>/build/ -miphoneos-version-min=7.0 -ObjC -fobjc-arc -fobjc-link-runtime -lCore -framework Foundation -framework CoreGraphics -framework UIKit -liTableView -liMedia -liHttp -liJSON -liStringUtils -liBarcode -liHUD -liRandomAccessFile -lb4i_alipay -framework AVFoundation -lz -framework AlipaySDK -framework Foundation -framework QuartzCore -framework UIKit -framework CFNetwork -framework CoreGraphics -framework CoreMotion -framework CoreTelephony -framework CoreText -framework SystemConfiguration -lCore -lc++ -liDebug2 -Xlinker -dependency_info -Xlinker /Users/administrator/Documents/UploadedProjects/<user id>/build/ -o /Users/administrator/Documents/UploadedProjects/<user id>/Payload/
ld: library not found for -lb4i_alipay
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I reference some issues and can't find the problem, did I make mistakes by create the lib or did I use it the wrong way? thanks very much

I'v checked the project in the object folder, the project contains the libb4i_alipay.a, but I got error above

:D I have done the following steps:
first, import the third party lib and it's depending framewrok, bundle into the project( including some .h/.m files and Util, openssl folders)
then I set the search path into the macserver/Libs folder, import iCore.h File ,and write code like this:

[[AlipaySDK defaultService] payOrder: orderString fromScheme:appScheme callback:^(NSDictionary *resultDic) {
NSLog(@"reslut = %@",resultDic);

then after generating a libb4i_alipay.lib , I use B4Ih2xml.jar and get a xml,
I put I into B4I project, but when I send It to server to builder the code , I get the error I first post

Ju Yang

Active Member
Licensed User
#import "iCore.h"

//~event: Finished

Alberto Iglesias

Well-Known Member
Licensed User
A little question about debugging Libraries for B4i:

How I can debug in XCODE a library for B4i? How instance this B4i object?

I try like this but not working:

B4IMyObject* objmy;
[objmy Initialize:self :@"objmy"];
[objmy Show:self :self];

and in my Library I have like:

-(void)Initialize:(B4I*)bi :(NSString *)EventName { }

Thanks in advance!

Alberto Iglesias

Well-Known Member
Licensed User
Anybody know how I can TEST the library directly in XCODE?

I need to instance my object created for B4i, and I need to know how create B4i Object

I try like this:

    B4I *objBI = [[B4I alloc]init];
    B4IMYLIB *objMy = [[B4IMYLIB alloc]init];;
    [objMy :@"objMy"];
Then problem is: What is this object I need to pass? is not correct! I think in B4iObjectWrapper but I don´t know how instance

How to get:

Try this too but without success, using "B4IStaticModule"
B4IStaticModule *objB4I = [[B4IStaticModulealloc]init];
B4IMYLIB *objmy = nil;
objmy = [B4IMYLIB new];
[objmy :@"objmy"];
Last edited:

Alberto Iglesias

Well-Known Member
Licensed User

This is for debug my library in XCODE directly, without using B4i.

This parameter in B4i is automatically, but in XCODE, I can´t understand..

B4I *objB4I = [[B4Ialloc]init];


[objmy Initialize:objB4I :@"objmy"];
Not work! When pass in Initialize, just in this line:
[B4IObjectWrappersetBIAndEventName:self :bi :EventName];

get this error

-[__NSCFConstantString ToLowerCase]: unrecognized selector sent to instance 0x100367010

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString ToLowerCase]: unrecognized selector sent to instance 0x100367010'

Alberto Iglesias

Well-Known Member
Licensed User

I´m using the same library (crytografy) in two B4i Libraries, I need this because I use in both.

If I use one of other library in B4i works perfectly, but when I use this two libraries in the same B4i project I got:

duplicate symbol _kCommonCryptoErrorDomain in:

How to ignore this error?


Alberto Iglesias