1. Load the static library *.a file
{$O-}
function Xe4_testframe:testframe; Cdecl
External ' libtestframe.a ' name ' Objc_class_$_testframe ';
2. Loading the dynamic library
Procedure Xe4_avfoundation; Cdecl
External '/system/library/frameworks/avfoundation.framework/avfoundation ';
Procedure Xe4_libz; Cdecl External '/usr/lib/libz.dylib ';
{$O +}
3. The corresponding. A file needs to be output in the deployment.
4. Need to introduce the required framework into the tool-option and update
5. Common Interface Definition
Testframe = Interface (nsobject)
[' {b02fe219-debd-4581-a33e-5f167552bf28} ']
function Testfuc (value:integer): integer; Cdecl
function Uv_initvoiceapp:integer; Cdecl
function Uv_startvoicelisten:boolean; Cdecl
function Delegate:pointer; Cdecl
Procedure Setdelegate (Delegate:pointer); Cdecl
function busy:boolean;cdecl;
Procedure Setbusy (V:boolean); cdecl;
function Uv_speak (text:nsstring): boolean;cdecl;
function isspeaking:boolean;cdecl;
End
Testframeclass = Interface (Nsobjectclass)
[' {1adaff51-4474-47a1-8d39-723ac6680d51} ']
End
Ttestframe = Class (Tocgenericimport<testframeclass, Testframe>)
End
6.delegate definition
Ios_voicedelegate = Interface (IOBJECTIVEC)
[' {3a72f24d-9b7b-4e9d-a572-f282147526d2} ']
Procedure Ios_onresult (resulttext:nsstring); Cdecl
Procedure ios_onvolumnchanged (Volumn:integer); Cdecl
End
Tios_voicedelegate = Class (Toclocal, Ios_voicedelegate)
Private
Ftestframe:tdpftestframe;
Public
Constructor Create (frame:tdpftestframe);
Procedure Ios_onresult (resulttext:nsstring); Cdecl
Procedure ios_onvolumnchanged (Volumn:integer); Cdecl
End
DELPHI XE loading iOS framework