Configuring iOS

To use this library on iOS, there are some frameworks, which Delphi should be aware of, but by default isn’t, so you need to perform the following changes in the IDE (you need to do this just once, it will apply to all projects):

  1. Go to Tools -> Options -> SDK Manager à iOS Device, for each iPhoneOS device:
  2. Click on any framework (just a click: there is a bug in IDE).
  3. Click “Add a new path item” image button (top one)
    1. Set “Path on remote machine” to “/System/Library/Frameworks” or “$(SDKROOT)/System/Library/Frameworks” (same as other frameworks).
    2. Set “Framework name” to “SystemConfiguration”.
    3. Click Ok (nothing should be selected in the radio and leave the checkbox unchecked).
  4. Repeat step 3 with Framework name “AdSupport”, “StoreKit”, “Social”, “CoreData”, “CoreTelephony”, “CoreMedia”, “SystemConfiguration”, “Security”, “EventKit”, “EventKitUI”, “AVFoundation”, “iAd”, “AudioToolbox”, “CoreBluetooth”, “SafariServices”, “CoreMotion”, “MediaPlayer”, “MobileCoreServices”, “CoreVideo”, “MessageUI”, “Metal”, “IOSurface”, “ImageIO”, “CoreAudio”, “MediaToolbox”, “CoreMIDI”, “JavaScriptCore”, “ModelIO”, “IOSurface”, “UserNotifications” (no need to duplicate already existing items: Delphi XE5, for example, already includes StoreKit and iAd).
  5. Click “Update Local File Cache” button.

In each project, which is using this library, you need to perform the following changes:

  1. Go to Project -> Options -> Delphi Compiler à Linking.
  2. Choose Target “All Configurations – iOS Device platform”.
  3. Enter the following value in “Options passed to the LD linked” (this should be written as a single line):
      -ObjC -lz -framework SystemConfiguration -weak_framework Social
      -weak_framework iAd -framework StoreKit -framework MessageUI
      -framework AudioToolbox -weak_framework AdSupport
      -framework Security -framework CoreData -framework EventKit
      -framework AVFoundation -framework CoreTelephony
      -framework EventKitUI -framework CoreMedia
      -framework CoreBluetooth -weak_framework SafariServices
      -weak_framework CoreMotion -framework MediaPlayer
      -framework CoreVideo -weak_framework MobileCoreServices
      -weak_framework FileProvider -weak_framework WebKit
      -weak_framework CFNetwork -weak_framework Metal
      -weak_framework ImageIO -weak_framework CoreAudio
      -weak_framework MediaToolbox -weak_framework CoreMIDI
      -weak_framework JavaScriptCore -weak_framework ModelIO

In addition to this the Receive Push Notifications should be selected within Project Option’s entitlements list, if you want to use push notifications. If you want to use AdMob, add a new version info key for iOS platforms, called “GADApplicationIdentifier”, with the value set to the app id supplied by AdMob.

  • Facebook Audience Network

Due to the way Audience Network is compiled by Facebook, there is a cumbersome way of configuring it for iOS use.

1. FBAudienceNetwork.framework folder is included with this suite. Copy it to your Mac machine.

2. Within your Mac sign this framework with the exact same identity that you use for the rest of your application, by executing:

/usr/bin/codesign --deep -s identity -f framework

For example:

/usr/bin/codesign --deep
-s "iPhone Developer: Yegor Kurbachev (ABCD12E3FG)"
-f "/Users/Yegor/Desktop/Frameworks/FBAudienceNetwork.framework"

3. Copy the (updated, signed) files back to your PC.

4. Configure their deployment into the Frameworks folder, copying sub-folders hierarchy (your deployment record should look something like in the picture).

Notice, if you are working on several apps, which use different signing, you would need to repeat this process for each signing certificate, taking care deploying the correct set. In case of an invalid signature, the execution will fail with an error “Unable to install package (e800801c)”.

If you do not know the name of the correct identify, switch PAServer into verbose mode (“v” command) and execute the app. You will see codesign execution with the identity name.