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

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

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

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.

Related

Xcode Error on Simulator: MGIsDeviceOneOfType is not supported on this platform

I have a very simple application with a single view, containing several UILabels. Upon running in Simulator, the Xcode console returns the error:
libMobileGestalt MobileGestalt.c:875: MGIsDeviceOneOfType is not supported on this platform.
The Simulator itself just shows a white screen. I've also tried running it on a developer device with the same white screen. I've searched documentation but can't find any reference to MGIsDeviceOneOfType.
The application is written in Swift in Xcode 10 beta on macOS 10.14. I am attempting to run it on the iPhone 7-X Simulators, as well as a development iPhone 7, all running the target software (12.0).
MobileGestalt
The libMobileGestalt.dylib provides a central repository for all of the iOS's properties. It can be analogous to OS X's Gestalt, which is part of CoreServices. OS X's Gestalt is documented for example Gestalt Manager and has been deprecated as of 10.8. MobileGestalt is entirely undocumented by Apple as it is a private library.
MobileGestalt allows for the testing of system properties that may or may not be compatible on different simulators.
Quite a few system processes and apps in iOS rely on MobileGestalt, which is located at /usr/lib/libMobileGestalt.dylib. It's more of a basic library, but its exposed APIs follow the Apple framework conventions and uses the MG API prefix for example MGIsDeviceOneOfType.
If you look for MobileGestalt on the iOS filesystem you won't find it - like all private frameworks and libraries, it has been prelinked into the /System/Library/Caches/...etc. If you like hacking and pen-testing then you can use tools to extract it.
MobileGestalt provides plenty of information - around 200 or so queries - on various aspects of the system. Here are a few.
libMobileGestalt.dylib
//Answers to MG queries
MGCopyAnswer(#"5MSZn7w3nnJp22VbpqaxLQ");
MGCopyAnswer(#"7mV26K/1a+wTtqiunvHMUQ");
MGCopyAnswer(#"BasebandAPTimeSync");
MGCopyAnswer(#"BasebandPostponementStatus");
MGCopyAnswer(#"BasebandPostponementStatusBlob");
MGCopyAnswer(#"BasebandSecurityInfoBlob");
MGCopyAnswer(#"BasebandStatus");
MGCopyAnswer(#"BuildVersion");
MGCopyAnswer(#"CoreRoutineCapability");
MGCopyAnswer(#"DeviceClass");
MGCopyAnswer(#"DeviceClassNumber");
MGCopyAnswer(#"DeviceName");
MGCopyAnswer(#"DeviceSupports1080p");
MGCopyAnswer(#"DeviceSupports720p");
MGCopyAnswer(#"DiskUsage");
MGCopyAnswer(#"GSDeviceName");
MGCopyAnswer(#"HWModelStr");
MGCopyAnswer(#"HasBaseband");
MGCopyAnswer(#"InternalBuild");
MGCopyAnswer(#"InverseDeviceID");
MGCopyAnswer(#"IsSimulator");
MGCopyAnswer(#"MLBSerialNumber");
MGCopyAnswer(#"MaxH264PlaybackLevel");
MGCopyAnswer(#"MinimumSupportediTunesVersion");
MGCopyAnswer(#"PasswordConfigured");
MGCopyAnswer(#"PasswordProtected");
MGCopyAnswer(#"ProductType");
MGCopyAnswer(#"ProductVersion");
MGCopyAnswer(#"RegionCode");
MGCopyAnswer(#"RegionalBehaviorNTSC");
MGCopyAnswer(#"RegionalBehaviorNoPasscodeLocationTiles");
MGCopyAnswer(#"ReleaseType");
MGCopyAnswer(#"SIMStatus");
There are hundreds more e.g. AirplaneMode, MobileEquipmentIdentifier, etc.
MobileGestalt maintains a table of OSType selector codes.
for example c:890 in the message: libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform. In this case MGIsDeviceOneOfType is a method/property of the MobileGestalt library.
Instead of checking the simulator version there is a separate selector for directly querying the capabilities of the simulator. The messages most likely indicate incompatibilities between simulator versions and Xcode versions and/or unsupported APIs on the simulator.
I've successfully dropped it with the disabling of the project garbage.
Go to <Name of your Project>->Scheme->Edit Scheme Then go to Run (menu to the left side) and add the following environment variable:
Name:OS_ACTIVITY_MODE, Value: disable
in my case: check your app delegate for method - didFinishLaunching. I had private and get the error. After remove "private" everything works fine
I just installed Xcode 10 Beta and had the same problem. Ran Xcode 9.4.1 and the problem went away.
This error will only occur when testing/debugging on simulators.
The newer the simulator the better.
Case: I run simulator iPhone 8 plus I got this message in the debugger.
Solution: I changed to a newer simulator no error message in the debugger.
Ran into this when opening some project from GitHub on Xcode 10.0.
The pragmatic solution was: just hit 'Continue program execution' multiple times and probably disable your exception breakpoint. Apparently the exception was recoverable.
It's not a real solution but it was good enough for me at that point.
In my case, the Target's Deployment Target was at iOS 8. When I pushed it up to iOS 10.3, it ran fine, both on the Simulator and the device.
Am seeing this problem. Using Xcode 10.1. Created a brand new project - doesn't do anything except show a white screen. Discovered it was showing up on simulator for older devices. For example, iPad Pro (12.9 inch) and iPad Pro (12.9 inch) (2nd generation) show the problem, but problem is gone for iPad Pro (12.9 inch) (3rd generation). Does not show up for iPhone XR simulator.
Basically seems annoying.
If you have fonts provided by the app, you need to add to Info.plist
And check if the file have the Target Membership selected
I had the same issue, but with MapKit, where a MapView did not show up, just the white screen and the same error, MGIsDeviceOneOfType is not supported on this platform.
Solved it by fixing "Ambiguous layout" warnings tied to the MapView object. Now it's working perfectly fine, and the errors went away.
The regular way when strange errors happens helped:
1) Clean project;
2) Shut down simulator;
3) Reinstall pods.
Xcode 10.
For me, with the simulator in question in focus, I selected Hardware->Erase all content and settings.
After the simulator restarted, launching my app worked again, as expected.
I went to XCode -> Preferences -> Components
Ticked all the simulators and the check box to install updates automatically, and then "check and Install now" and went away for a few hours while they all updated.
Now the problem is gone - so in fact, it's as mentioned. New XCode with Old - non-updated simulators.
What worked for me was to change within general > Deployment Info > Main Interface to CDVLaunchScreen and do the same within general > App Icons and Launch Images > Launch Screen File to CDVLaunchScreen as well.
I come from Ionic, so this might not be a problem for those who develop in Swift / Objective-C.
I have recently updated to Xcode 10.2 and when I tried to run a project created in earlier version, Same error occurred.
The problem was that simulator was running before updating Xcode.
Solution was very simple for me to quit Simulator and restart so that it can get the new changes. I don't think the model of the simulator (iPhone SE or iPhone X) matters. You just need to restart your simulator for it to take effect of new update.
I would recommend to quit both Xcode and simulator and restart your Mac.
I got this error by calling .sync on the main queue which caused a deadlock (DispatchQueue.main.sync {}). I meant to call .async.
I got this error, when trying to read a json file which is inside my project and it returned nil, due to that i got this error.
I got nil because of some spelling mistake in the font name, that json file was holding the font names, after copy pasting the font name i got data and the error fixed.
I tried allmost all of the solutions given above, nothing worked, So debug with patience, you will get to know which is causing this error and in some bad time xcode will play in our life :)
I was facing same problem but I've successfully dropped it with below things:
Shutdown simulator,
Shutdown Xcode,
Re-open Xcode and simulator
I hope it will help.

This app could not be installed at this time.Xcode 9.2

I have changed my application name and bundle identifier and now when i'm trying to run my app it is showing an error that This app could not be installed at this time . Why it is so? Why it isn't running the app?
I know the question has been answered but for others encountering the same issue I suggest following:
Check simulator logs, if its printing something useful. First, selecte simulator then from menu option open Debug -> Open System Logs.
Make sure only 1 simulator is running.
Delete the older version of app from the simulator.
If you importing a custom framework, make sure custom framework->bundle-id is not same as currentAppProject->bundle-id. If you are not sure then simply change the bundle-id of current project.
Also some of the simulators can be buggy -> Simply change the simulator, it may resolve the issue, for me changing the simulator worked.

Xcode 9 Alternate App Icons - Invalid Image Path

I use alternate app icons in my app (which is currently in the App Store). Since upgrading to Xcode 9, I get errors when submitting to the App Store (see screenshots). The alternate icon works properly when running on the simulator/device.
The main app icon is included in the Asset catalog, and the alternate icon is added directly to the project (which I needed to do to get it to work in Xcode 8.3). I've double checked that all the alternate app icon files are part of the app target.
I'm also getting some errors regarding missing required app icon files, which seems suspicious since they're all there as far as I can tell.
I'm using Xcode Server to create my builds, and submitting to the App Store from the integration results page.
Please let me know if you need any other information to help me solve this issue.
EDIT: I created an archive manually using Xcode, and that archive was accepted. Looks like this is an issue with archives created by Xcode Server.

Delphi iOS - no .ipa file generated - unable to install library (e800080)

So I am following this Delphi guide on app store submission:
http://docwiki.embarcadero.com/RADStudio/XE4/en/Deploying_Your_iOS_Application_for_Submission_to_the_App_Store
So in section Generate an Application Archive File for Your Application it states it should generate an .ipa file in my project directory + scratch directory on Mac. But it does not as far as I can tell. Instead I get an able about Delphi unable to install library using the paramaters defined in my profile.
I have attached a screenshot that shows I am building and deploying for release/iosdevice/appstore.
And here is the error I get:
And here is my project options / provisioning:
Worth mentioning that one has to use /Users/username/Library/MobileDevice/Provisioning Profiles/letters-and-digits.mobileprovision for it to work, otherwise scratchdir is used for search.
And here is version info:
I have used com.example.myname (what you see in xCode - Organizer - Applications) instead of idcode.com.example (what you see in Xcode - Organizer - Provisioning profiles) for CFBundleIdentifier. I think that is correct although not 100% sure?
While I still have problems. (Apparently Application Loader believes my bundle id is wrong even though I have tried changing it to match what it requests.) I managed to get over this. I just needed to added "Developer program ID" (which works if you have a valid provisioning profile listed)
You are trying to run your iOS application on an iOS device that does not match the iOS form factor (UIDeviceFamily) defined for your project. For example, you might be trying to run your iOS application on an iPad, but your application is configured to run on an iPhone only.
Select Project > Options > Version Info and choose a UIDeviceFamily value that matches your iOS device. For example, choose iPhone & iPad to run your application on any iOS device.

XE4 Deployment error

Good afternoon all. Apologies if SO isn't the place to ask, I wasn't sure there was an 'errors stack exchange' or such, and whether or not any XE4 users would be visitors there.
I'm currently trying out the XE4 trial, and I'm wanting to see just whether the iOS implementation is as easy as they made it look.
I've got my remote profile all setup and working, and I've made a small application that only contains a progress bar. Now, when I deploy that application to the simulator, it runs on the iOS simulator as expected.
However, when I try to deploy to a device, I get the following error;
[DCC Error] E2597 ld: warning: directory not found for option '-FC:\Users\Scott\Documents\RAD Studio\SDKs\iPhoneOS5.0.sdk\System\Library\PrivateFrameworks'
I've tried Debug, Ad-hoc, and App Store profiles, but they all return the same error. The folder 'PrivateFrameworks' doesn't even exist. There's one called 'Frameworks' in the 'Library' folder, but nothing else. I considered that maybe it's an incorrect SDK library path, but the only one with such a path is 'UIFoundation'. Changing the path to 'frameworks' like the others are returns this;
[DCC Error] E2597 ld: warning: can't parse __DATA/__objc_imageinfo section in C:\Users\Scott\Documents\RAD Studio\SDKs\iPhoneOS5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
That file DOES exist (99KB) but the error remains (and so I assume that changing the SDK lib path wasn't the right thing to do). It's like it's not even attempting to deploy over to the mac for compilation due to a file or folder issue.
Any ideas?
You could look at the checklist in the Troubleshooting: Cannot Deploy to the iOS Device help topic.
If you have not run your iOS app on the iOS Simulator, make sure you satisfy the requirements here:
Troubleshooting: Cannot Deploy to the iOS Simulator
Make sure your iOS device is connected to your Mac by USB cable.
Specify the iOS Device as the target platform in the Project Manager.
Complete the Provisioning page. (Your developer certificate is required for code signing)
Set the required Project Options for your iOS app:
Specify your application icons - Application Options.
Specify info.plist keys such as UIDeviceFamily - Version Info.
Install the Xcode command-line tools on your Mac. (Required for code signing your iOS app)
There are links in the documentation above with details about some of the steps involved.
I had extactly the same issue. It happened when trtying to deploy to the iOS 5.0 simulator (not even an iOS device).
It appears that UIFoundations (PrivateFrameworks) gets pulled across and cached when you setup the SDK for iOS 6.1 on XE4.
Make sure the sumulators are installed on Xcode in preferences. Restart Xcode (make sure the PA server is running). Setup a connection profile with the 6.1 SDK in options on XE4 and it works.
Hope this makes sense but it solved my issue.
Add the missing framework into your SDK. Tools->Options->SDK Manager, go to Frameworks and click the yellow button. Also remember to press "Update Local File Cache" after you're done. You will find that you will need to fetch more Frameworks and Libraries in the future.

Resources