'Session Ended' when lauching app from Delphi to iOS Simulator

2.2k views Asked by At

I'm trying to deploy a multi-platform application (written in Delphi XE7 + Firemonkey) to iOS Simulator, through these parameters:

  • Delphi XE7
  • OSX 10.8 Mountain Lion
  • XCode 5.1.1
  • Command Line Tools
  • PAServer 15.0 (iOS SDK 7.1 - also tested with 6.1)

My Application needs to work in Windows, Android, iOS and OSX. Working already for all but iOS, including OSX which I compile to using the same setup, with no problems.

I created a connection profile to my PAServer, using a password, and this profile works OK both compiling to OSX and when compiling a hello-world-ish application for iOS, just with a button or two.

As for my app, I can compile and build it for iOS without a problem, but when I try to run it in iOS-Simulator, it compiles, deploys, and when launching, it fails, returning an error:

Unable to launch process on '192.168.25.37' using the parameters from the 'iOS' profile. The following error was returned: 'Session Ended'

This is my first app for iOS, so I'm swimming in strange waters here. It has no external libraries, except of course for the ones Delphi itself might add when compiling. I myself did not, and the app has just forms, and accesses a text file in its sandbox folder, and a mysql server via UniDac (direct mode, no dll's).

I tried to get to the bottom of it, commenting out sensible code in my app, namely everything that was iOS specific, but that amounted to nothing.

I then created a new app, just a button and a ShowMessage on its handler and it worked.

Next step, I started trying out my app units on this simpler app. The first one I tried was a unit I have for a custom component (a TRectangle with a TPanel, 3x TImage, a TLabel and a TCheckbox inside), with another class with a Generics TObjectList of the component). I just added this unit, without instantiating any class, and it failed, reporting an 'unknown error'.

So I removed the unit from the project to double check: Again it fails, with the same button and showmessage that worked before.

I've installed then the SDK 7.1, but failed as well.

I've been looking through the web trying to make some sense out of it, and have found several similar cases, but none that could actually help me:

Delphi FireMonkey iOS App: Error while Deploying to iPhone Simulator 8.1 On this case, there's a problem with PAServer and there's a fix for it, but it refers for SDK 8.1 and XCode 6+

Unable to install and run iOS app on Simulator from command line - Simulator of iOS 6.1 Xcode 5 on mavericks I couldn't install ios-sim via the refered way, most probably because I have zero experience with OSX. Still, I cloned it from GitHub and managed to install it via command line and XCodeBuild with some help from internet, but when I tried to run my app, ios-sim says it needs at least XCode 6, which I don't have (OSX 10.8 here, I believe Xcode 6 needs at least 10.9).

After that, I installed another, iPhoneSim, and strangelly, after that ios-sim no longer questions for Xcode6. Still, it fails to start my app (even a freshly created hello-world-ish that works when run via Delphi), stating:

DEBUG] Failed to find class DTiPhoneSimulatorSystemRoot at runtime.

Even tried installing WaxSim, but this one failed to install.

I did not however tried compiling it for a iDevice, because for that I need to subscribe Apple Developer program, and I was hoping to do that only after making sure everything was working OK. Plus, I', not sure it would make a difference.

Has anyone experienced this 'Session Ended' problem, and if so, do you know of any reason and fix.

Thank you

2

There are 2 answers

0
nunopicado On BEST ANSWER

After a few days, I found out what the problem was, so I'll post the solution here to help others who might have the same problem.

Go to Project --> Project Options --> Version Info

Under de iOS Simulator configuration, Delphi IDE (XE7) automatically inserted the following key and value:

CFBundleVersion = 1.0.0

As it turns out, there are several other tweaks needed for an iOS project: Here are the keys found in Embarcaderos iOS demo app "Location", which solved my problem once I inserted them in my project:

CFBundleName = $(ModuleName)
CFBundleDevelopmentRegion = en
CFBundleDisplayName = $(ModuleName)
CFBundleIdentifier = $(ModuleName)
CFBundleInfoDictionaryVersion = 7.1
CFBundlePackageType = APPL
CFBundleSignature = ????
LSRequiresIPhoneOS = true
CFBundleAllowMixedLocalizations = YES
CFBundleExecutable = $(ModuleName)
UIDeviceFamily = iPad & iPhone
CFBundleResourceSpecification = ResourceRules.plist
NSLocationAlwaysUsageDescription = The reason for accessing the location information of the user
NSLocationWhenInUseUsageDescription = The reason for accessing the location information of the user
FMLocalNotificationPermission = false

There is one special key, which I believe it's the main reason for the 'Session Ended' error: UIDeviceFamily

This key has 3 options (instead of accepting any string value): - iPhone - iPad - iPhone & iPad

Without this, iOS simulator doesn't know which type of app it is, UI wise, so it doesn't launch. You need to add the key with the respective key name, and then choose the UI type using the respective ComboBox.

Also missing in the project is in:

Project -> Project Options -> Application There is a list, both for iPhone and iPad, with the paths to the default icons, in several sizes, which is not correctly filled when creating a new Project.

So, you can either use your own icons and images, or use the defaults:

iPhone:

Application Icon 57x57: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png
Application Icon 60x60: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
Application Icon 87x87: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png
Application Icon 114x114: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png
Application Icon 120x120: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
Application Icon 180x180: $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png
Launch Image 320x480: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png
Launch Image 640x960: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png
Launch Image 640x1136: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png
Launch Image 750x1334: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png
Launch Image 1242x2208: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png
Launch Image 2208x1242: $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png
Spotlight Search Icon 29x29: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png
Spotlight Search Icon 40x40: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
Spotlight Search Icon 58x58: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png
Spotlight Search Icon 80x80: $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png


iPad:

Application Icon 72x72: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png
Application Icon 76x76: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
Application Icon 144x144: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png
Application Icon 152x152: $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
Launch Image 768x1004: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png
Launch Image 768x1024: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
Launch Image 1024x748: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png
Launch Image 1024x768: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
Launch Image 1536x2008: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png
Launch Image 1536x2048: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
Launch Image 2048x1496: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png
Launch Image 2048x1536: $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
Spotlight Search Icon 40x40: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
Spotlight Search Icon 50x50: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png
Spotlight Search Icon 80x80: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
Spotlight Search Icon 100x100: $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png
Setting Icon 29x29: $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png
Setting Icon 58x58: $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png
0
S.L. Barth is on codidact.com On

We had the same error message, although with a slighty different environment (Delphi XE8 and Yosemite).

In our case, there were parentheses in the name of the connection. We found this out by putting PAServer in verbose mode, using the "v" command, and repeating the commands we saw in a separate terminal.

Editing the parentheses out of the connection name solved the problem for us.