Jacob from TwoDesk Software Company has a blog post up about how to access Objective-C objects on OSX from Delphi XE5 & XE6 Firemonkey. It should also work in AppMethod and I believe these same methods that apply to OSX also apply to IOS. It covers how to access four different fundamental elements of Objective-C from Delphi. Those elements are static methods of an Objective-C class, an interface to a instance of an Objective-C class, an Objective-C object ID, and finally Delphi strings as NSStringObjects. The sample function that is demonstrated in the blog entry is a how to do a synchronous HTTP request using the native OSX TNSURLConnection object and return the results into a TMemo. The purpose being to use the native operating system object instead of using something like the TIdHTTP component which is the Indy HTTP request component. I think it does a really good job of explaining each type of object and how to access that object. Be sure to read the Recap section at the bottom of the post as it specifically tells you in a few lines exactly how to access the fundamental elements of the OSX API. Here is the final sample function for making an HTTP request:
procedure TForm1.Button1Click(Sender: TObject);
URL := TNSURL.Wrap(TNSURL.OCClass.URLWithString(
URLRequest := TNSURLRequest.Wrap(TNSURLRequest.OCClass.requestWithURL(URL));
Data := TNSURLConnection.OCClass.sendSynchronousRequest(URLRequest, @Response,
Memo1.Lines.Text := PAnsiChar(Data.bytes);
Four Fundamental Ways To Interface With Objective-C In Delphi XE5 Firemonkey On OSX And IOS by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.