Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Delphi XE8, using iOS framework gives AV


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Jul 1, 2015 4:46 AM Last Post By: Hans Jakobsen Threads: [ Previous | Next ]
Hans Jakobsen

Posts: 103
Registered: 9/10/01
Delphi XE8, using iOS framework gives AV  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 28, 2015 7:16 AM
The app uses the iOS framework CoreMIDI and works fine targeting iOSDevice (8.2), but on iOSSimulator (iOS8.2) I get an AV on the first function call (MIDIGetNumberOfSources) from this framework.

There are no errors shown by Delphi, nor by the paServer in Verbose mode, and a *new empty app that only calls MIDIGetNumberOfSources, does not fail either*!

How can calling a framework suddenly not work, in this main app?

I think the bindings for the framework are correct. I have added the framework to the iPhoneSimulator 8.2 SDK in the Delphi SDK manager, updated local File Cache and verified that the framework exists in C:\Users\Hans\Documents\Embarcadero\Studio\SDKs\iPhoneSimulator8.2.sdk\System\Library\Frameworks.
If any of these things had been wrong I suppose the new empty app would have failed too.

Here is the system log from the simulator:

May 27 12:00:49 Hanss-Mac-mini.local CoreSimulatorBridge[23458]: LaunchServices: installing app for existing placeholder <LSApplicationProxy: 0x78e114a0> MyMobileApp
May 27 12:00:49 Hanss-Mac-mini.local CoreSimulatorBridge[23458]: LaunchServices: Not creating progress for <LSApplicationProxy: 0x78e114a0> MyMobileApp since it is not a placeholder.
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 -[MIClientConnection _doBackgroundInstallationForPath:withOptions:completion:]: Install of "/Users/Hans/PAServer/scratch-dir/Hans-MyMac/MyMobileApp.app" type Developer requested by CoreSimulatorBridge (pid 23458)
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 MDMCreateDeltaDirectory: calling MDMDirectoryDiff with:
    state->old_bundle: /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Containers/Bundle/Application/E2DFA4FB-E2C9-42C1-A755-222E6AFF6D87/MyMobileApp.app
    state->new_bundle: /Users/Hans/PAServer/scratch-dir/Hans-MyMac/MyMobileApp.app
    state->dst_bundle: /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Library/Caches/com.apple.mobile.installd.staging/temp.oUQjRY/extracted/Payload//MyMobileApp.app, binaryDiff flag: FALSE
        dst_ipa: /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Library/Caches/com.apple.mobile.installd.staging/temp.oUQjRY/extracted
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 createDictFromFile: open failed for /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Containers/Bundle/Application/E2DFA4FB-E2C9-42C1-A755-222E6AFF6D87/ManifestCache.plist : No such file or directory
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0115000 __MDMDirectoryDiff_block_invoke29: calling writeDictToFile with: /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Library/Caches/com.apple.mobile.installd.staging/temp.oUQjRY/extracted/ManifestCache.plist
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0115000 writeDictToFile: ==== Successfully wrote Manifest cache to /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Library/Caches/com.apple.mobile.installd.staging/temp.oUQjRY/extracted/ManifestCache.plist
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 -[MIInstaller performInstallationWithError:]: Installing <MIInstallableBundlePatch ID=MyMobileApp; Version=1.0.0, ShortVersion=1.0>
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 -[MIInstallableBundlePatch applyPatchWithError:]: Attempting patch update of MyMobileApp from 1.0.0 (1.0) to 1.0.0 (1.0)
May 27 12:00:49 Hanss-Mac-mini.local SpringBoard[23450]: Killing MyMobileApp for termination assertion
May 27 12:00:49 Hanss-Mac-mini.local pkd[23466]: releasing plug-in hold D3EDD1F4-6903-4308-BDD2-7F24E721085E for dead client pid 23450
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 -[MIInstallableBundle _refreshUUIDForContainer:withError:]: Data container for MyMobileApp is now at /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Containers/Data/Application/F784D308-C571-4BF4-83DD-4C4762BCB6C2
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 -[MIContainer makeContainerLiveReplacingContainer:withError:]: Made container live for MyMobileApp at /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/Containers/Bundle/Application/D29B70CB-4B8B-4EF6-9625-09E37F6579F4
May 27 12:00:49 Hanss-Mac-mini.local installd[23446]: 0xb0093000 -[MIInstaller performInstallationWithError:]: Staging: 0.02s; Waiting: 0.00s; Installation: 0.05s; Overall: 0.06s
May 27 12:00:49 Hanss-Mac-mini.local CoreSimulatorBridge[23458]: LaunchServices: NotifiedObservers <LSApplicationProxy: 0x78e14c90> MyMobileApp was installed
May 27 12:00:49 Hanss-Mac-mini.local lsd[23464]: LaunchServices: Updating identifier store
May 27 12:00:49 Hanss-Mac-mini.local SpringBoard[23450]: libMobileGestalt MobileGestalt.c:841: still-camera is static and will never generate a notification
May 27 12:00:49 Hanss-Mac-mini.local SpringBoard[23450]: libMobileGestalt MobileGestalt.c:841: stand-alone-contacts is static and will never generate a notification
May 27 12:00:49 Hanss-Mac-mini.local /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/libexec/lsd[23464]: LaunchServices: Failed to set the data protection class for /Users/Hans/Library/Developer/CoreSimulator/Devices/ADAE10FD-2A7E-4168-947B-FDFF09D540A3/data/tmp/com.apple.IconsCache/MyMobileApp_defaultRole-FM_ApplicationIcon_57x57_FM_ApplicationIcon_87x87_FM_ApplicationIcon_114x114_FM_ApplicationIcon_72x72_FM_ApplicationIcon_144x144_FM_ApplicationIcon_76x76_FM_ApplicationIcon_152x152_FM_ApplicationIcon_60x60_FM_ApplicationIcon_120x120_FM_ApplicationIcon_180x180-32
May 27 12:00:49 Hanss-Mac-mini.local SpringBoard[23450]: Installed apps did change.
    Added: {(
    )}
    Removed: {(
    )}
    Modified: {(
        MyMobileApp
    )}
May 27 12:00:50 Hanss-Mac-mini assertiond[23454]: assertion failed: 13F1077 12D508: assertiond + 14743 [849F745E-3AAA-3638-91FF-892312A54F42]: 0x1
Hans Jakobsen

Posts: 103
Registered: 9/10/01
Re: Delphi XE8, using iOS framework gives AV  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 3, 2015 6:02 AM   in response to: Hans Jakobsen in response to: Hans Jakobsen
Any suggestions what I can do?

I think the problem is not related to the specific framework, it could happen with any framework.
It works on the iOS device, but not in the iOS Simulator. I am on XE8, and unfortunately I do not know if it works with XE7 because it does not support the iOS8 simulator.

Could this error happen if the framework is not found?
- or what else could cause an AV when calling a framework function?
Borja Serrano

Posts: 172
Registered: 1/10/13
Re: Delphi XE8, using iOS framework gives AV  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 4, 2015 8:48 AM   in response to: Hans Jakobsen in response to: Hans Jakobsen
Take a look here:

http://mobilepascal.blogspot.com.es/2013/05/delphi-xe4-with-ios-13-procedure-for.html

I think you need to call to "dlopen" to load the framework under the iOS simulator
Hans Jakobsen

Posts: 103
Registered: 9/10/01
Re: Delphi XE8, using iOS framework gives AV  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 8, 2015 7:08 AM   in response to: Borja Serrano in response to: Borja Serrano
Borja Serrano wrote:
Take a look here:
http://mobilepascal.blogspot.com.es/2013/05/delphi-xe4-with-ios-13-procedure-for.html
I think you need to call to "dlopen" to load the framework under the iOS simulator

Thank you. I checked up on this and found that it is already done the right way: The header file of the library loads it, and the load returns a handle, so at that point everything looks fine. But later when I call a function in the framework I get an Access Violation.

Tried to call the framework at a later point, but then it is just another framework that fails. This time it was calling CGImageSourceCreateWithData in the ImageIO framework.

Any ideas what can make those frameworks unavailable?
- or ideas how I can debug this?
Hans Jakobsen

Posts: 103
Registered: 9/10/01
Re: Delphi XE8, using iOS framework gives AV  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 1, 2015 4:46 AM   in response to: Hans Jakobsen in response to: Hans Jakobsen
Still not solved :-( - but now I have more information to add:

When I call a framework that I added manually to the SDK manager, I get this error: "Project dyld_sim raised exception class EAccessViolation with message 'Access violation at address 015A8019, accessing address 00000010'
".

It fails in my main large app, but it works with a new empty app, when calling the same function in the same framework.

My debugging has revealed something interesting:
I made a unit that only calls 'MIDIGetNumberOfSources' in the initialization section (this is the function in CoreMIDI that used to fail).
Now if I place this unit in my main project uses section before 'FMX.Forms,' then it does not fail, and when I later make the real call to 'MIDIGetNumberOfSources' (which used to fail) it also works!
It tried to do the same trick with the 'AudioToolbox' framework, but unfortunately this always failed no matter when it was called.

Any ideas?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02