Delphi, Firemonkey, IOS, and TCP howto?

I was really excited about the new ability to compile IOS apps written in Delphi, but I'm starting to find some major limitations, unless I'm really overlooking something. I want to write an iphone/pad app that needs to retrieve data from a socket connection, or from a webpage (http, webservice, anything). It seems that all of the Firemonkey internet and indy components are not supported within xcode. 

Am I overlooking something here, or is this a feature that will not be implemented, or is it planned to be implemented?

If this kind of communication is not supported, this is a huge limitation of the new XE2 in my opinion. I hope I'm just overlooking something.

Thanks for any advice!
0
Registered
9/2/2011 3:13:53 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

12 Replies
1936 Views

Similar Articles

[PageSpeed] 24

Registered Programmer wrote:
> I was really excited about the new ability to compile IOS apps
> written in Delphi, but I'm starting to find some major limitations,
> unless I'm really overlooking something. I want to write an
> iphone/pad app that needs to retrieve data from a socket connection,
> or from a webpage (http, webservice, anything). It seems that all of
> the Firemonkey internet and indy components are not supported within
> xcode.      
> 
> Am I overlooking something here, or is this a feature that will not
> be implemented, or is it planned to be implemented? 
> 
> If this kind of communication is not supported, this is a huge
> limitation of the new XE2 in my opinion. I hope I'm just overlooking
> something.  
> 
> Thanks for any advice!

CFSocket looks like a good choice, included in Macapi.CoreFoundation.pas.
http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFSocketRef/Reference/reference.html

-- 
Arno Garrels
0
Arno
9/2/2011 4:18:41 PM
> {quote:title=Arno Garrels wrote:}{quote}
> Registered Programmer wrote:
> > I was really excited about the new ability to compile IOS apps
> > written in Delphi, but I'm starting to find some major limitations,
> > unless I'm really overlooking something. I want to write an
> > iphone/pad app that needs to retrieve data from a socket connection,
> > or from a webpage (http, webservice, anything). It seems that all of
> > the Firemonkey internet and indy components are not supported within
> > xcode.      
> > 
> > Am I overlooking something here, or is this a feature that will not
> > be implemented, or is it planned to be implemented? 
> > 
> > If this kind of communication is not supported, this is a huge
> > limitation of the new XE2 in my opinion. I hope I'm just overlooking
> > something.  
> > 
> > Thanks for any advice!
> 
> CFSocket looks like a good choice, included in Macapi.CoreFoundation.pas.
> http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFSocketRef/Reference/reference.html

Is that also available for iOS? iOS _does_ include a CoreFoundation framework, but the "Macapi" suggests that this might be for OS X, not iOS.

In general, there often low-level (Core) framework like this that have a simple "C" interface and high-level (NS) frameworks that consist of Objective C classes that wrap the low-level Core functions. Either can be used. Newer stuff is generally available only as ObjC classes, though, so you can see the trend.

Thanks.

-Phil
0
Phil
9/2/2011 5:37:25 PM
I see that I can use the NSURLxxx classes from within xcode itself for IOS development, but I am developing this app in Delphi, Rad Studio XE2. I don't believe I have access to the IOS foundation from there. Do you know if there is some sort of wrapper for these classes, or how to access them from within XE2?

Thanks!
0
Registered
9/2/2011 7:54:04 PM
> {quote:title=Registered Programmer wrote:}{quote}
> I see that I can use the NSURLxxx classes from within xcode itself for IOS development, but I am developing this app in Delphi, Rad Studio XE2. I don't believe I have access to the IOS foundation from there. Do you know if there is some sort of wrapper for these classes, or how to access them from within XE2?

OS X has access to these ObjC frameworks:

http://docwiki.embarcadero.com/RADStudio/en/Mac_OS_X_Application_Development#Mac_Objective-C_Frameworks

Look for something similar for iOS. With FPC that you build yourself and parse the header files yourself, the iPhoneAll unit includes CoreFoundation, CoreGraphics, Foundation, OpenGLES, QuartzCore, and UIKit frameworks, but this may not be the way they parsed the ObjC framework headers with XE2.

Thanks.

-Phil
0
Phil
9/2/2011 8:02:13 PM
> {quote:title=Phil Hess wrote:}{quote}
> > CFSocket looks like a good choice, included in Macapi.CoreFoundation.pas.
> > http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFSocketRef/Reference/reference.html
> 
> Is that also available for iOS? iOS _does_ include a CoreFoundation framework, but the "Macapi" suggests that this might be for OS X, not iOS.
> 
> In general, there often low-level (Core) framework like this that have a simple "C" interface and high-level (NS) frameworks that consist of Objective C classes that wrap the low-level Core functions. Either can be used. Newer stuff is generally available only as ObjC classes, though, so you can see the trend.

Maybe this IP on iPhone using NS frameworks tutorial can be of interest?
http://www.devx.com/wireless/Article/43551

--
http://delphi.fosdal.com - Delphi Programming
http://plus.lars.fosdal.com - Google+
0
Lars
9/3/2011 4:08:24 PM
> {quote:title=Lars Fosdal wrote:}{quote}
> > {quote:title=Phil Hess wrote:}{quote}
> > > CFSocket looks like a good choice, included in Macapi.CoreFoundation.pas.
> > > http://developer.apple.com/library/ios/#documentation/CoreFoundation/Reference/CFSocketRef/Reference/reference.html
> > 
> > Is that also available for iOS? iOS _does_ include a CoreFoundation framework, but the "Macapi" suggests that this might be for OS X, not iOS.
> > 
> > In general, there often low-level (Core) framework like this that have a simple "C" interface and high-level (NS) frameworks that consist of Objective C classes that wrap the low-level Core functions. Either can be used. Newer stuff is generally available only as ObjC classes, though, so you can see the trend.
> 
> Maybe this IP on iPhone using NS frameworks tutorial can be of interest?
> http://www.devx.com/wireless/Article/43551

The point is that no tutorial will be very useful if a developer can't use the underlying iOS frameworks.

Here's an example of what's needed (in this case, the Foundation framework):

http://iphonedevelopertips.com/cocoa/json-framework-for-iphone-part-2.html

Look at the first Objective C method (stringWithUrl:). Here it is transliterated into Objective Pascal. Easy if you have access to the NS classes; if not, well...

function TestUrl1AppDelegate.stringWithUrl(url: NSURL) : NSString;
var
  urlRequest : NSURLRequest;
  urlData : NSData;
  response : NSURLResponse;
  error : NSError;
begin
  urlRequest := NSURLRequest.requestWithURL_cachePolicy_timeoutInterval(
                 url, NSURLRequestReturnCacheDataElseLoad, 30);

   //Fetch the JSON response

   //Make synchronous request
  urlData := NSURLConnection.sendSynchronousRequest_returningResponse_error(
              urlRequest, @response, @error);
 
   //Construct a string from the response data
  Result := NSString.alloc.initWithData_encoding(urlData, NSUTF8StringEncoding).autoRelease;
end;


Thanks.

-Phil
0
Phil
9/4/2011 1:38:33 AM
Hi

I am very interested in using TCP sockets on IOS application.
I have an existing windows app which provides a TCP server and I'd like to talk to that app from an IOS device (Ipod touch), so I need some way of doing the socket client on both IOS and Windows.

Are there any examples of how this can be done so that you can still test your app on the windows environment, then compile for the IOS on the MAC and have the same code run?

or

Do you need to use different components for each of the systems, which kind of defeats the purpose of Firemonkey.

Obviously, would be good if Indy worked both, but I see that it doesn't have a date yet for being available for both.
0
Barry
11/5/2011 1:50:57 AM
> {quote:title=Barry Andrews wrote:}{quote}
> Hi
> 
> I am very interested in using TCP sockets on IOS application.
> I have an existing windows app which provides a TCP server and I'd like to talk to that app from an IOS device (Ipod touch), so I need some way of doing the socket client on both IOS and Windows.
> 
> Are there any examples of how this can be done so that you can still test your app on the windows environment, then compile for the IOS on the MAC and have the same code run?
> 
> or
> 
> Do you need to use different components for each of the systems, which kind of defeats the purpose of Firemonkey.
> 
> Obviously, would be good if Indy worked both, but I see that it doesn't have a date yet for being available for both.

Use the CFNetwork framework:

http://oreilly.com/iphone/excerpts/iphone-sdk/network-programming.html

Maybe something like this would work for you cross-platform:

http://www.realthinclient.com/

If you need something more modern like a Web service, try this:

http://wiki.freepascal.org/Web_Service_Toolkit

This library is also popular. I've parsed the header files and tested it with iOS and Pascal. It has some nifty features:

http://allseeing-i.com/ASIHTTPRequest/

Thanks.

-Phil
0
Phil
11/5/2011 4:03:15 AM
Hello

Its been quite a while but after a busy start to the work year finally got the chance to do some work on this again.
I finally found a decent exaple of how to use this, it's in Japanese but code is pretty self explanatery and translate works quite good.

http://blogs.embarcadero.com/teamj/2012/04/03/3002/

This is a good example because it not only shows the code but also the conditionals needed for IOS and all the uses so you can just copy and test.

This runs as is, but when I start to expand on for my own requirements I have found that I get EXC_BAD_ACCESS errors when I run on the MAC.
I think this is due to my need to process the received strings and use them to update the UI.
Are there any thread safe string types for Freepascal under IOS that I can use to overcome this issue?

Currently in the on receive I am just adding the string to a global string

{code}
rcvdData: TStrings; // Ansistring UTF-8

procedure ReceiveData(str: string);
begin
     rcvdData := rcvdData + str;
end;
{code}

Then I parse the string in a timer routine.

I now I need to make this safe for threades but cannot find any examples of how to do this with firemonkey under ios using the free pascal.
0
Barry
8/12/2012 2:47:00 AM
Le 12/08/12 03:47, Barry Andrews a écrit :

> This runs as is, but when I start to expand on for my own
> requirements I have found that I get EXC_BAD_ACCESS errors when I run
> on the MAC. I think this is due to my need to process the received
> strings and use them to update the UI. Are there any thread safe
> string types for Freepascal under IOS that I can use to overcome this
> issue?
>
> Currently in the on receive I am just adding the string to a global
> string
>
> {code}
> rcvdData: TStrings; // Ansistring UTF-8
>
> procedure ReceiveData(str: string);
> begin
>       rcvdData := rcvdData + str;
> end;
> {code}
>
> Then I parse the string in a timer routine.
>
> I now I need to make this safe for threades but cannot find any
> examples of how to do this with firemonkey under ios using the free
> pascal.

My first question would be that you say you are parsing "the string" and 
yet you are using a TStrings variable, which is a list of strings.

Where are you instantiating a TStringList into the rcvdData variable and 
why are you using '+' instead of the Add method to add strings to it?

Joanna

-- 
Joanna Carter [Team OOAD]
0
Joanna
8/12/2012 8:16:10 AM
> {quote:title=Joanna Carter (Team OOAD) wrote:}{quote}
> Le 12/08/12 03:47, Barry Andrews a écrit :
> 
> > This runs as is, but when I start to expand on for my own
> > requirements I have found that I get EXC_BAD_ACCESS errors when I run
> > on the MAC. I think this is due to my need to process the received
> > strings and use them to update the UI. Are there any thread safe
> > string types for Freepascal under IOS that I can use to overcome this
> > issue?
> >
> > Currently in the on receive I am just adding the string to a global
> > string
> >
> > {code}
> > rcvdData: TStrings; // Ansistring UTF-8
> >
> > procedure ReceiveData(str: string);
> > begin
> >       rcvdData := rcvdData + str;
> > end;
> > {code}
> >
> > Then I parse the string in a timer routine.
> >
> > I now I need to make this safe for threades but cannot find any
> > examples of how to do this with firemonkey under ios using the free
> > pascal.
> 
> My first question would be that you say you are parsing "the string" and 
> yet you are using a TStrings variable, which is a list of strings.
> 
> Where are you instantiating a TStringList into the rcvdData variable and 
> why are you using '+' instead of the Add method to add strings to it?
> 
> Joanna
> 
> -- 
> Joanna Carter [Team OOAD]

My mistake when copying, I was going to try something with TStrings, but didn't undo the change before posting, rcvdData is actually just a string.
0
Barry
8/12/2012 1:27:30 PM
> {quote:title=Registered Programmer wrote:}{quote}
> I was really excited about the new ability to compile IOS apps written in Delphi, but I'm starting to find some major limitations, unless I'm really overlooking something. I want to write an iphone/pad app that needs to retrieve data from a socket connection, or from a webpage (http, webservice, anything). It seems that all of the Firemonkey internet and indy components are not supported within xcode. 
> 
> Am I overlooking something here, or is this a feature that will not be implemented, or is it planned to be implemented?
> 
> If this kind of communication is not supported, this is a huge limitation of the new XE2 in my opinion. I hope I'm just overlooking something.

You can use various Foundation classes to do that. See the "NSURLxxx" classes here:

http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/ObjC_classic/_index.html#//apple_ref/doc/uid/20001091

Thanks.

-Phil
0
Phil
10/4/2012 5:55:46 PM
Reply:

Similar Artilces:

Delphi XE4 - Firemonkey
I have an application that runs fine on windows, however when running on iOS simulator the onKeyUp event for a TEdit control is not being fired? Please advise if this event should get fired when running on iOS? This problem occurs onKeyUp events created directly on the control and by assigning the event programatically. Running XE4 update 1 iPhoneOS6.1.sdk Minimac: OS X 10.9 XCode 5 iOS Simulator Version 7.0 - iPad Retina / iOS 7.0.3(11B508) ...

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Delphi iOS 7 firemonkey xe5 VideoZoomFactor unimplemented
Hi, I want to use the new IOS 7 AVCaptureDevice feature VideoZoomFactor in Delphi XE5 but the feature hasn't been implemented. Is there a good way to use features that haven't yet been added to base objects in delphi? Are those header files, like IOSapi.AVFoundation.pas machine generated? I modified the files FX.Media.IOS, iOSap.AVFoundation and FMX.Media to add the missing feature i wanted and recompiled. That worked for this feature, but I would like to find a better way. is there a timetable to releasing the iOS 7 features in firemonkey? I was kind of surprised to find i...

Implementing a sip client on delphi xe4 firemonkey for iOS
:-) I need to develop a voice and video SIPclient for iOS using XE4 Firemonkey. What the best way to do this? It´s SIP supported by Firemonkey? Are there any APIs? Regards Gustavo wrote: > I need to develop a voice and video SIPclient for iOS using > XE4 Firemonkey. What the best way to do this? Good luck. SIP is not a trivial protocol to implement manually. You are best off finding a pre-made SIP library to do the work for you. > It´s SIP supported by Firemonkey? I seriously doubt it. > Are there any APIs? SIP is an application-layer proto...

How do you rate you experience programming for IOS in Delphi/Firemonkey [Edit]
Hello: I've been taking a IOS programming course in objective-c/swift with xcode, and while doing my homework assignments I came to the conclusion that this is a very finicky environment, where very often things don't work as expected or there is always some minor UI glitch that has to be fixed or found workarounds for. Just to give you some examples (by far not an exaustive list): a UITableView doesn't align to the top when you use a navigation controller; upon selecting a row in a UITableView some buttons in the row disappear while the row is selected; specifying layout con...

Ann: X-platform report generator for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Delphi XE8 FireMonkey iOS Style problem with segmented buttons
Hi, Going through some tutorials to get used to mobile development using FireMonkey and Delphi XE8. One of the most basic layouts tend to use the toolbar component with segmented speed buttons, and then applying the correct segmented style to each button. However, there seems to be an issue with the iOS style. ...

Delphi XE8 FireMonkey iOS Style problem with segmented buttons [Edit]
Hi, Going through some tutorials to get used to mobile development using FireMonkey and Delphi XE8. One of the most basic layouts tend to use the toolbar component with segmented speed buttons, and then applying the correct segmented style to each button. However, there seems to be an issue with the iOS style. [Screenshot.|https://drive.google.com/file/d/0B68Ju-patBf-RVVEMmI5UDd2cG8/view?usp=sharing] Using the "segmentedbuttonleft", "segmentedbuttonmiddle", and "segmentedbuttonright" styles is producing an extra border on the right button in iOS. It seems...

I can to install one not delphi program foir iOS into one iOS for delphi?
For example i have one programm builded as xcode for iOS, and i build one program as delphi for iOS. I want to have only one instalation, i can to add this xcode program into my delphi installer of my ios program? I can to do the same as android? how i can to to this? > {quote:title=oscar mejia wrote:}{quote} > For example i have one programm builded as xcode for iOS, and i build one program as delphi for iOS. I want to have only one instalation, i can to add this xcode program into my delphi installer of my ios program? > > I can to do the same as android? how i can to to...

Ann: TsiLang Components Suite v7.1! (Multilanguage solution for Delphi and C++Builder with full FireMonkey support including Android and iOS)
Hello, We're glad to announce the release of TsiLang Components Suite 7.1! Simple and powerful localization solution for software developers. It's virtually impossible to find popular software that would not be translated (localized) into multiple languages. In fact, even niche and second-tier developers localize their products to increase international sales. Unfortunately, the process of software localizations is both time consuming and very expensive. Luckily, developers who use Delphi, or C++Builder platform can use TsiLang Components Suite to localize their software...

Ann: TsiLang Components Suite v7.1! (Multilanguage solution for Delphi and C++Builder with full FireMonkey support including Android and iOS)
Hello, We're glad to announce the release of TsiLang Components Suite 7.1! Simple and powerful localization solution for software developers. It's virtually impossible to find popular software that would not be translated (localized) into multiple languages. In fact, even niche and second-tier developers localize their products to increase international sales. Unfortunately, the process of software localizations is both time consuming and very expensive. Luckily, developers who use Delphi, or C++Builder platform can use TsiLang Components Suite to localize their software...

Installing components for FireMonkey HD and FireMonkey iOS
Hi, How do I install components for both FireMonkey HD and FireMonkey iOS? I have one package 'FMXMyFireMonkeyControl' and 'FMIFireMonkeyControl' which both point to the same file with the same registration 'TFireMonkeyControl'. If I compile one package (FMXMyFireMonkeyControl) it installs correctly, then change the include file (FMCompile.INC) to compile for IOS (FMIFireMonkeyControl) which is included in the FMX.FireMonkeyControl.pas file: {$I FMCOMPILE.INC} uses {$IFDEF COMPILEIOS} FMX_Types, FMX_Objects, FMX_Forms, FMX_Dialogs, FMX_Effe...

Making Firemonkey more compatible with Delphi
I have programmed in Delphi since 1995 Delphi1 I am now evaluating Delphi XE4. It boggles my mind, why embarcadero has lost the most important aspects of Delphi. Simplicity and Fast User Interface creation. I can easily see how Firemonkey can be improved to bring it in line with traditional Delphi Techniques by doing the following. 1. All Firemonkey controls need a data aware counterpart. 2. Firemonkey Styles need to be converted to TControl descendants. 3. ie. TLayout goes to TPanel ( TFMXPanel ) 4. ie. TRectangle does to TFrame TFMXFrame ) 5. LiveBindings gets placed un...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Web resources about - Delphi, Firemonkey, IOS, and TCP howto? - embarcadero.delphi.firemonkey

Firemonkeys - GamesIndustry International
The world's leading games industry website. Get insight from todays industry leaders with news, interviews and analysis of global gaming trends. ...

Firemonkey’s Real Racing 3 To Launch At The End Of February
In September, Apple demoed Firemonkey’s Real Racing 3 at the iPhone 5 event . Three months later and the game has yet to show up in the App Store. ...

EA Games and Firemonkey Bringing Real Racing 3 to Android, Fasten your Seat Belts
Start up your engines race fans, EA Games is teaming up with Firemonkey to bring Real Racing 3 to mobile devices. If you’re a fan of more realistic ...

EA's Firemint and IronMonkey Studios Merge to Become FireMonkeys
... game development studios into one mega-studio in Australia. Firemint and IronMonkeys will be merged into a single studio now known as Firemonkeys ...

News: Firemonkeys announces Real Racing 3
Firemonkeys, a new gaming subsidiary of Electronic Arts born from the merger of FireMint and IronMonkey, has announced the coming release of ...

firemonkeys - iMore
EA has pushed out another impressive update to its equally impressive iOS racer, Real Racing 3, that for the first time brings cars from Ferrari ...

Firemonkeys on Real Racing 3 going free-to-play
... got a hands-on preview of Real Racing 3. We also spoke with Ptolemy Oberin, one of the game’s programmers and project lead at developer Firemonkeys, ...

Real Racing 3 coming in 2012 from Firemonkeys
The first game from recently merged developer Firemonkeys is Real Racing 3 , the developer revealed moments ago during EA's Summer Showcase event ...

Firemonkeys Previews Real Racing 3 for iPhone and iPad
Firemonkeys, the new combined studio from EA combining the IronMonkey and Firemint gaming studios, has announced the development of Real Racing ...

EA Mobile Moves: IronMonkey & Firemint Merge Into “Firemonkeys,” Now Have 50M Players Between
... that it is merging two top mobile game studios, IronMonkey and Firemint , which will fittingly combine to create a new company, called Firemonkeys. ...

Resources last updated: 12/26/2015 2:44:31 PM