Jump to content

Recommended Posts

I have this problem,
I have to make sure that my IO App made with Delphi Rio can appear in the list of apps with which to share a web link.
For example if I am on safari and I am visiting a site I want to share this link with my app. I tried adding the management of CFBundleDocumentTypes and CFBundleURLTypes in the info.plist file but unfortunately my app does not appear in the list.
Instead, there is the possibility to send the link to whatsapp, email, notes, and many other apps.
Once opened my app must capture the link and use it internally.
Do you know how I can do it?
Thanks
Massimiliano

90086.jpg

Share this post


Link to post

Hi Dave,

I did several tests on the info.plist file
Now I'm trying with this (but I'm only interested in receiving web links). I see my app when I have to open some  files (PDF example) but I don't see my app on the list share from safari or other browsers and apps.

Bye

Massimiliano

 

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<%VersionInfoPListKeys%>
<%ExtraInfoPListKeys%>
    <key>CFBundleIdentifier</key>
    <string>youaddict.diesys.it</string>
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLName</key>
        <string>YouAddict</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>youaddict://html</string>
          <string>http://</string>
          <string>https://</string>
          <string>http://WebsiteURL</string>
          <string>https://WebsiteURL</string>
        </array>
      </dict>
    </array>
    
    
<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>IPA</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.item</string>
                <string>public.content</string>
                <string>public.data</string>
                <string>public.database</string>
                <string>public.composite-content</string>
                <string>public.contact</string>
                <string>public.archive</string>
                <string>public.url-name</string>
                <string>public.text</string>
                <string>public.plain-text</string>
                <string>public.source-code</string>
                <string>public.executable</string>
                <string>public.script</string>
                <string>public.shell-script</string>
                <string>public.xml</string>
                <string>public.symlink</string>
                <string>org.gnu.gnu-zip-archve</string>
                <string>org.gnu.gnu-tar-archive</string>
                <string>public.image</string>
                <string>public.movie</string>
                <string>public.audiovisual-content</string>
                <string>public.audio</string>
                <string>public.directory</string>
                <string>public.folder</string>
                <string>com.apple.bundle</string>
                <string>com.apple.package</string>
                <string>com.apple.plugin</string>
                <string>com.apple.application-bundle</string>
                <string>com.pkware.zip-archive</string>
                <string>public.filename-extension</string>
                <string>public.mime-type</string>
                <string>com.apple.ostype</string>
                <string>com.apple.nspboard-typ</string>
                <string>com.adobe.pdf</string>
                <string>com.adobe.postscript</string>
                <string>com.adobe.encapsulated-postscript</string>
                <string>com.adobe.photoshop-image</string>
                <string>com.adobe.illustrator.ai-image</string>
                <string>com.compuserve.gif</string>
                <string>com.microsoft.word.doc</string>
                <string>com.microsoft.excel.xls</string>
                <string>com.microsoft.powerpoint.ppt</string>
                <string>com.microsoft.waveform-audio</string>
                <string>com.microsoft.advanced-systems-format</string>
                <string>com.microsoft.advanced-stream-redirector</string>
                <string>com.microsoft.windows-media-wmv</string>
                <string>com.microsoft.windows-media-wmp</string>
                <string>com.microsoft.windows-media-wma</string>
                <string>com.apple.keynote.key</string>
                <string>com.apple.keynote.kth</string>
                <string>com.truevision.tga-image</string>
            </array>
            <key>CFBundleTypeIconFiles</key>
            <array>
                <string>Icon-76@2x</string>
            </array>
        </dict>
    </array>
    
    
</dict>
</plist>

Share this post


Link to post

I meant the final info.plist that ends up being deployed with your app, i.e. not the info.plist.TemplateiOS.xml. This is in case it is different somehow.

Share this post


Link to post

Ops sorry

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>YaApple</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>YaApple</string>
    <key>CFBundleIdentifier</key>
    <string>youaddict.diesys.it</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>7.1</string>
    <key>CFBundleVersion</key>
    <string>1.0.0</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.0</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>LSRequiresIPhoneOS</key>
    <string>true</string>
    <key>CFBundleAllowMixedLocalizations</key>
    <string>YES</string>
    <key>CFBundleExecutable</key>
    <string>YaApple</string>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>
    <key>CFBundleResourceSpecification</key>
    <string>ResourceRules.plist</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>The reason for accessing the location information of the user</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>The reason for accessing the location information of the user</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>The reason for accessing the location information of the user</string>
    <key>FMLocalNotificationPermission</key>
    <string>false</string>
    <key>UIBackgroundModes</key>
    <array>
    </array>
    <key>NSContactsUsageDescription</key>
    <string>The reason for accessing the contacts</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>The reason for accessing the photo library</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>The reason for adding to the photo library</string>
    <key>NSCameraUsageDescription</key>
    <string>The reason for accessing the camera</string>
    <key>NSFaceIDUsageDescription</key>
    <string>The reason for accessing the face id</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>The reason for accessing the microphone</string>
    <key>NSSiriUsageDescription</key>
    <string>The reason for accessing Siri</string>
    <key>ITSAppUsesNonExemptEncryption</key>
    <string>false</string>

    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>CFBundleIconFiles</key>
    <array>
        <string>FM_ApplicationIcon_57x57</string>
        <string>FM_ApplicationIcon_87x87</string>
        <string>FM_ApplicationIcon_114x114</string>
        <string>FM_ApplicationIcon_60x60</string>
        <string>FM_ApplicationIcon_120x120</string>
        <string>FM_ApplicationIcon_180x180</string>
        <string>FM_SpotlightSearchIcon_29x29</string>
        <string>FM_SpotlightSearchIcon_40x40</string>
        <string>FM_SpotlightSearchIcon_58x58</string>
        <string>FM_SpotlightSearchIcon_80x80</string>
        <string>FM_SpotlightSearchIcon_120x120</string>
        <string>FM_ApplicationIcon_72x72</string>
        <string>FM_ApplicationIcon_144x144</string>
        <string>FM_ApplicationIcon_76x76</string>
        <string>FM_ApplicationIcon_152x152</string>
        <string>FM_ApplicationIcon_167x167</string>
        <string>FM_SpotlightSearchIcon_40x40</string>
        <string>FM_SpotlightSearchIcon_50x50</string>
        <string>FM_SpotlightSearchIcon_80x80</string>
        <string>FM_SpotlightSearchIcon_100x100</string>
        <string>FM_SettingIcon_29x29</string>
        <string>FM_SettingIcon_58x58</string>
    </array>
    <key>UILaunchImages</key>
    <array>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{320, 480}</string>
            <key>UILaunchImageName</key>
            <string>Default</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{320, 568}</string>
            <key>UILaunchImageName</key>
            <string>Default-640w-1136h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{320, 568}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-640w-1136h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{375, 667}</string>
            <key>UILaunchImageName</key>
            <string>Default-750w-1334h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{375, 667}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-750w-1334h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{414, 736}</string>
            <key>UILaunchImageName</key>
            <string>Default-1242w-2208h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{414, 736}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-1242w-2208h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{375, 812}</string>
            <key>UILaunchImageName</key>
            <string>Default-1125w-2436h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>11.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{375, 812}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-1125w-2436h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>11.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{414, 896}</string>
            <key>UILaunchImageName</key>
            <string>Default-828w-1792h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>12.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{414, 896}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-828w-1792h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>12.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{414, 896}</string>
            <key>UILaunchImageName</key>
            <string>Default-1242w-2688h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>12.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{414, 896}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-1242w-2688h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>12.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
    </array>
    <key>UILaunchImages~ipad</key>
    <array>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{768, 1024}</string>
            <key>UILaunchImageName</key>
            <string>Default-Portrait</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{768, 1024}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{768, 1024}</string>
            <key>UILaunchImageName</key>
            <string>Default-1536w-2048h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{768, 1024}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-1536w-2048h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>7.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{834, 1112}</string>
            <key>UILaunchImageName</key>
            <string>Default-1668w-2224h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>10.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{834, 1112}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-1668w-2224h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>10.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{834, 1194}</string>
            <key>UILaunchImageName</key>
            <string>Default-1668w-2388h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>12.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{834, 1194}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-1668w-2388h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>12.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{1024, 1366}</string>
            <key>UILaunchImageName</key>
            <string>Default-2048w-2732h</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>9.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
        </dict>
        <dict>
            <key>UILaunchImageSize</key>
            <string>{1024, 1366}</string>
            <key>UILaunchImageName</key>
            <string>Default-Landscape-2048w-2732h.png</string>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>9.0</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
        </dict>
    </array>
    <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key><true/>
        </dict>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>arm64</string>
    </array>
    <key>CFBundleSupportedPlatforms</key>
    <array>
        <string>iPhoneOS</string>
    </array>
    <key>CFBundleResourceSpecification</key>
    <string>ResourceRules.plist</string>
    <key>MinimumOSVersion</key>
    <string>8.0</string>
    <key>DTPlatformName</key>
    <string>iphoneos</string>
    <key>DTPlatformBuild</key>
    <string>16E226</string>
    <key>DTXcodeBuild</key>
    <string>10E1001</string>
    <key>DTSDKBuild</key>
    <string>16E226</string>

    <key>CFBundleIdentifier</key>
    <string>youaddict.diesys.it</string>
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLName</key>
        <string>YouAddict</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>youaddict://html</string>
          <string>http://</string>
          <string>https://</string>
          <string>http://WebsiteURL</string>
          <string>https://WebsiteURL</string>
        </array>
      </dict>
    </array>
    
    
<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>IPA</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.item</string>
                <string>public.content</string>
                <string>public.data</string>
                <string>public.database</string>
                <string>public.composite-content</string>
                <string>public.contact</string>
                <string>public.archive</string>
                <string>public.url-name</string>
                <string>public.text</string>
                <string>public.plain-text</string>
                <string>public.source-code</string>
                <string>public.executable</string>
                <string>public.script</string>
                <string>public.shell-script</string>
                <string>public.xml</string>
                <string>public.symlink</string>
                <string>org.gnu.gnu-zip-archve</string>
                <string>org.gnu.gnu-tar-archive</string>
                <string>public.image</string>
                <string>public.movie</string>
                <string>public.audiovisual-content</string>
                <string>public.audio</string>
                <string>public.directory</string>
                <string>public.folder</string>
                <string>com.apple.bundle</string>
                <string>com.apple.package</string>
                <string>com.apple.plugin</string>
                <string>com.apple.application-bundle</string>
                <string>com.pkware.zip-archive</string>
                <string>public.filename-extension</string>
                <string>public.mime-type</string>
                <string>com.apple.ostype</string>
                <string>com.apple.nspboard-typ</string>
                <string>com.adobe.pdf</string>
                <string>com.adobe.postscript</string>
                <string>com.adobe.encapsulated-postscript</string>
                <string>com.adobe.photoshop-image</string>
                <string>com.adobe.illustrator.ai-image</string>
                <string>com.compuserve.gif</string>
                <string>com.microsoft.word.doc</string>
                <string>com.microsoft.excel.xls</string>
                <string>com.microsoft.powerpoint.ppt</string>
                <string>com.microsoft.waveform-audio</string>
                <string>com.microsoft.advanced-systems-format</string>
                <string>com.microsoft.advanced-stream-redirector</string>
                <string>com.microsoft.windows-media-wmv</string>
                <string>com.microsoft.windows-media-wmp</string>
                <string>com.microsoft.windows-media-wma</string>
                <string>com.apple.keynote.key</string>
                <string>com.apple.keynote.kth</string>
                <string>com.truevision.tga-image</string>
            </array>
            <key>CFBundleTypeIconFiles</key>
            <array>
                <string>Icon-76@2x</string>
            </array>
        </dict>
    </array>
    
    
</dict>
</plist>

Share this post


Link to post

It appears you need to create a share extension:

 

https://stackoverflow.com/a/38037060/3164070

 

This needs to be done in Xcode, although according to this article:

 

https://blog.grijjy.com/2018/11/15/ios-and-macos-app-extensions-with-delphi/

 

You can exchange data between a Delphi app and the extension.

 

Incidentally, I believe the schemes in your info.plist should not include the :// part, and apparently you cannot use http and https anyway:

 

https://stackoverflow.com/a/37401487/3164070

Share this post


Link to post

Hi Dave,

I followed your article and created an empty project in xCode with the same BundleID as my delphi project.

Then I created a share extension app extension in xcode, I compiled in development mode and everything went well When I set up the ad hoc mode xCode asked me to specify the TeamID.

I copied the contents of the PlugIns folder inside my delphi folder and I used your tools to add it to the deployment

 

 

Unfortunately now when I compile I find myself in front of another obstacle because I receive this message And unfortunately, I have found almost nothing for Tokyo and Rio about this problem.

 

[PAClient Error] Error: E0776 2020-07-16 19:39:51.200 xcodebuild[2174:173287] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/c1/9bp_6p2551799vynm572wy5r0000gn/T/YaApple_2020-07-16_19-39-51.199.xcdistributionlogs'.

[PAClient Error] Error: E0776 error: exportArchive: No 'teamID' specified and no team ID found in the archive

[PAClient Error] Error: E0776 Error Domain=IDEFoundationErrorDomain Code=1 "No 'teamID' specified and no team ID found in the archive" UserInfo={NSLocalizedDescription=No 'teamID' specified and no team ID found in the archive}

 

has this ever happened to you?

I found few posts without solutions

 

 

When I have overcome this obstacle I will have to understand how to make my app read the data received from the extension

Share this post


Link to post
21 minutes ago, Massimiliano S said:

I followed your article

It's not my article; it's Grijjy's. Allen Drennan visits here some times, and he is part of their group.

40 minutes ago, Massimiliano S said:

No 'teamID' specified and no team ID found in the archive

Might be an issue with the provisioning profile. Are you building for Ad-Hoc or App Store?

Share this post


Link to post

Hi Dave,

 

For now I have circumvented the problem of certificates but now I am stuck on another point.

 

  1. I created the extension app in xCode 11.4  on Catalina using SDK 13.5 I used an Ad Hoc profile
  2. I copied the PlugIns folder into my delphi 10.3.3 application with SDK 13.5
  3. I tried to compile and install the 64 Bit app as it is and it works
  4. added the PlugIns folder with all the sub folders to the deployment using the Deployman.exe tool
  5. I compiled the 64 Bit app and delphi compiles correctly
  6. I installed the app on the phone but I get the following message:

 

"this app needs to be updated by the developer to work on this version of IOS"

 

Reading on the Internet it would seem linked to the fact that 32-bit apps are no longer supported but I have compiled everything 64-bit and the problem occurs only when I import the PlugIns folder

 

Even in xCode it should compile only 64 Bit if I'm not mistaken

 

Can you give me some advice?

Share this post


Link to post
1 hour ago, Massimiliano S said:

added the PlugIns folder with all the sub folders to the deployment using the Deployman.exe tool

Can you show what the remote paths are?

 

1 hour ago, Massimiliano S said:

Reading on the Internet it would seem linked to the fact that 32-bit apps are no longer supported but I have compiled everything 64-bit

Just a guess, but perhaps make sure you haven't enabled the Generate iOS universal binary file (armv7 + arm64) option in the compiler options. Otherwise I'd need to see an example project

Share this post


Link to post

Hi Dave,
thank you very much for your reply, you are very kind
I confirm that I have not enabled universal binary and that I am compiling only 64 bit
I have attached a test application.
The PlugIn was done with Visual Studio code 11.4 and SDK 13.5
The delphi project (this test but also the final one) is with Rio 10.3.3. and SDK 13.5

If I compile in delphi the project without plugIn works
If I compile the app in xCode with the Share Extension it works
If I compile the delphi project with the Share Extension compiles correctly but then the app does not start and says that it needs to be updated

Bye

Massimiliano

yadiesys.zip

Share this post


Link to post

Your extension was not compiled for iOS (arm64), it was compiled for macOS (x86_64). To determine this, I ran this command on the Mac:

file yashare

For which the result was:

yashare: Mach-O 64-bit executable x86_64

When you created the extension, were you adding a Target from an iOS project? It should have looked like this:

 

image.thumb.png.7fe4a18ad6acd02280960b9f7b5d25e3.png

 

The target properties would then look like this:

image.thumb.png.6942037c9b29ab238faa46bcaab04830.png

 

 

Edited by Dave Nottage

Share this post


Link to post

Hi dave,
sorry it's always me and I would love to repay you for your precious help
I was able to compile the plug in and make IOS see my app in the share.
Now unfortunately I have to complete the code but I have problems doing it and the example is not very clear to me
https://blog.grijjy.com/2018/11/15/ios-and-macos-app-extensions-with-delphi/

What I need to do is put the code in xcode to send the link in my plugin
and put the code in delphi in my app to get the code.
Do you have any tips or an example already done?

Then if you come to Italy I will have to offer you a drink

 

Here the code of my plug .it

#import "ShareViewController.h"

 

@interface ShareViewController ()

@end

@implementation ShareViewController

 

- (BOOL)isContentValid {

 

    // Do validation of contentText and/or NSExtensionContext attachments here

 

    return YES;

}

- (void)didSelectPost {

 

    // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.

    // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.

 

    [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];

}

- (NSArray *)configurationItems {

    // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.

    return @[];

}

 

@end

Share this post


Link to post
9 hours ago, Massimiliano S said:

Do you have any tips or an example already done?

The extension (a Notification extension) I did (which I don't have working yet) does not need to communicate to the Delphi app, however the Grijjy article covers communicating between the extension in the section titled "Exchanging data with your App Extension", i.e. you need to set up an Application Group, and you need to use the NSUserDefaults class to share information between the extension and your app.

Share this post


Link to post
11 hours ago, Massimiliano S said:

Hi dave,
sorry it's always me and I would love to repay you for your precious help
I was able to compile the plug in and make IOS see my app in the share.
Now unfortunately I have to complete the code but I have problems doing it and the example is not very clear to me
https://blog.grijjy.com/2018/11/15/ios-and-macos-app-extensions-with-delphi/

What I need to do is put the code in xcode to send the link in my plugin
and put the code in delphi in my app to get the code.

Hello Massimillano,

 

I sent you an email this morning but it said you were "out of the office".  The article shows how to use XPC to exchange the information with your extension.  All the code required to do that is included in the blog article, it's not much.

 

The strange part is you have to create an "Application group" in the Apple developer portal and then add it to your info.plist in order to use XPC (inter-process communication between the app and the extension)

 

Let me know if you have any questions

Edited by Allen@Grijjy

Share this post


Link to post
8 hours ago, Allen@Grijjy said:

Hello Massimillano,

 

I sent you an email this morning but it said you were "out of the office".  The article shows how to use XPC to exchange the information with your extension.  All the code required to do that is included in the blog article, it's not much.

 

The strange part is you have to create an "Application group" in the Apple developer portal and then add it to your info.plist in order to use XPC (inter-process communication between the app and the extension)

 

Let me know if you have any questions

Hi Allen, Hi Dave
I received, thank you very much, yes in theory I should be on vacation with my children but until I close this problem I'm blocked.

I created a group on apple and managed to put my share exension in delphi and compile.
The problem is that now my share extension and my app in delphi are two empty boxes. Probably now the most is done but I don't know xcode and I'm struggling a bit.

If I now run my app on the iPhone the strange thing is that if I share a safari link to my app what happens is that the same site opens for me on the mac

 

So the first thing to do is work on the app.
My app must listen to receive links (both closed and open) and it is not necessary to send anything to the extension.

 

To do this I have to enter this code but it is not clear where. In the OnCreate of the main form?

 

var

  Defaults: NSUserDefaults;

  SharedSettings: MissingNSUserDefaults;

begin

    { Init with the proper Application Group suite name }

  Defaults := TNSUserDefaults.Alloc;

  SharedSettings := TMissingNSUserDefaults.Wrap((Defaults as ILocalObject).GetObjectID);

  SharedSettings.initWithSuiteName(StrToNSStr('group.it.diesys.yadiesys'));

 

 

 

I think this part is used to send data to the Share Extension and therefore in my case it should not be necessary, right?

  { Save SomeKey/SomeValue to the shared settings }

  SharedSettings.setObject(

    (StrToNSStr('SomeValue') as ILocalObject).GetObjectID,

    StrToNSStr('SomeKey') );

 

  { Update the settings }

  SharedSettings.synchronize;

 

Should the synchronize be called every time something is sent?

 

How does the app know when a link is sent to it?

and how can I extract it?

 

Now comes the more complex part because I don't know xCode
If I open my Extension I only have a file a ShareViewController.h file with the interface and a ShareViewController.m that implements the interface.

 

#import "ShareViewController.h"

 

@interface ShareViewController ()

 

@end

 

@implementation ShareViewController

 

- (BOOL)isContentValid {

    // Do validation of contentText and/or NSExtensionContext attachments here

    return YES;

}

 

- (void)didSelectPost {

    // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.

    

    // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.

    [self.extensionContext completeRequestReturningItems:@[] completionHandler:nil];

}

 

- (NSArray *)configurationItems {

    // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.

    return @[];

}

 

@end

 

Where should I insert this code?

NSString *const AppGroupName = @" group.it.diesys.yadiesys'";

 

This shouldn't be necessary because my Extension just has to send, right?

// Settings passed from the host application

NSString *someValue;

 

 

Where should I insert this code?

// Create and share access to an NSUserDefaults object

NSUserDefaults *sharedSettings = [[NSUserDefaults alloc] initWithSuiteName: AppGroupName];

 

 

Now what I have to do is send the Link, how do I capture and send it?

 

Thank you very much

Massimiliano

Share this post


Link to post

I sent you an email with some example attachments separately.... In regards to your questions:

 

My app must listen to receive links (both closed and open) and it is not necessary to send anything to the extension.

Does this mean your app must open/run if it’s not running when the extension needs it?

 

To do this I have to enter this code but it is not clear where. In the OnCreate of the main form?

You can do it anywhere in code. 

 

I think this part is used to send data to the Share Extension and therefore in my case it should not be necessary, right?

Yes, if you only want to receive from the share extension it is not required.  From your description of your requirements you need to translate the example from Delphi into Objective C and put that into your plugin in XCode.

 

Should the synchronize be called every time something is sent?

Yes

 

How does the app know when a link is sent to it? and how can I extract it?

The app should poll using something like a TTimer.  It needs to call synchronize to make sure it has an updated copy of the data during the polling.

 

Where should I insert this code? NSString *const AppGroupName = @" group.it.diesys.yadiesys'";

The constant is at the top of your plugin code directly after @implementation.

 

This shouldn't be necessary because my Extension just has to send, right?

Correct.  You need to do something like we show in Delphi, but in Objective-C inside of XCode in your plugin.  That should look something like this:

 

// Create and share access to an NSUserDefaults object

NSUserDefaults *sharedSettings = [[NSUserDefaults alloc] initWithSuiteName: AppGroupName];

   

// Set shared object key/value

[[NSUserDefaults sharedSettings] setObject:somevalue forKey:@"somekey"];

 

// Synchronize

[sharedSettings synchronize];

 

Where should I insert this code? Now what I have to do is send the Link, how do I capture and send it?

I have never made this type of app extension, so I am not sure where you place the code on XCode side until I know what extension you are making.  Each app extension works differently.

 

Are you making a “share” extension for Safari?  Are you trying to capture all urls from Safari into your app?  Could you explain what you are doing a little bit better?  If you could clarify I might be able to advise you where to capture what you want to capture.

 

I have never made this type of extension so I don’t know if what you want to do is possible.  Apple has all sorts of weird rules and restrictions on grabbing data from other apps.

Edited by Allen@Grijjy

Share this post


Link to post

Hi Allen,

received email, thank you very much

 

My app must listen to receive links (both closed and open) and it is not necessary to send anything to the extension.

Does this mean your app must open/run if it’s not running when the extension needs it?

Yes, if my app is closed it should open automatically when a link arrives
A bit like android intents and a bit like other apps do (e.g. notes etc ..)

 

Where should I insert this code? Now what I have to do is send the Link, how do I capture and send it?

I have never made this type of app extension, so I am not sure where you place the code on XCode side until I know what extension you are making.  Each app extension works differently.

 

I have seen that this extension has 2 methods
IsContentValid
didSelectedPost
The first I think should be implemented with the controls on the selected content
The second should send the place (I suppose)

Then there is a configurationItems

 

 

Are you making a “share” extension for Safari?  Are you trying to capture all urls from Safari into your app?  Could you explain what you are doing a little bit better?  If you could clarify I might be able to advise you where to capture what you want to capture.

The precise operation is as follows:

  • The user browses the websites and when he finds a site he likes, he shares it with my app.
  • My app must simply receive only a url that runs to a web services that I have made and that extracts from the site the name and some information that may be useful to the user.
  • For example, I browse the site
  • https://www.zara.com/it/it/donna-borse-pelle-l1041.html?v1=1549268
  • I see this bag that I like and I decide to save it.
  • My app receives this link, processes it and saves it into a personal database

So the only information needed is the site address and perhaps the name

 

 

 

 

Share this post


Link to post

I went back a re-read your original post.  Thanks for the clarification..  I think you need to place everything inside of "didSelectPost".  Warning!  I have not tested this example:

 

- (void)didSelectPost {
    NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
    NSItemProvider *itemProvider = item.attachments.firstObject;
    if ([itemProvider hasItemConformingToTypeIdentifier:@"public.url"]) {
        [itemProvider loadItemForTypeIdentifier:@"public.url" options:nil completionHandler:^(NSURL *url, NSError *error) {
            NSString *urlString = url.absoluteString;

            // Call your Delphi app here!!!

            // Share access to an NSUserDefaults object
            NSUserDefaults *sharedSettings = [[NSUserDefaults alloc] initWithSuiteName: AppGroupName];

            // Set shared object key/value
            [[NSUserDefaults sharedSettings] setObject:urlString forKey:@"TheUrlString"];

            // Synchronize
            [sharedSettings synchronize];
        }];
    }
}

 

Replace TheUrlString with the key you are using for GetObject on the Delphi app side.

 

Also you could skip the constant for AppGroupName and instead write the line like:

NSUserDefaults *sharedSettings = [[NSUserDefaults alloc] initWithSuiteName: @"group.it.diesys.yadiesys"];

 

Edited by Allen@Grijjy

Share this post


Link to post

Additionally, from what I have read, you cannot open/run the containing application (in your case a Delphi host application) from the share extension if the app is not already running.  However, you can start your application by running a Url Protocol handler to launch your Delphi app.  I was planning on writing a blog article about this topic.

 

I put together a small example of how to implement a protocol handler that works on macOS and iOS and Delphi apps.  It is attached here.  There is a small EventManager unit included to simplify the process.  The only thing you really need to do is modify the info.plist.TemplateOSX.xml (or info.plist.TemplateiOS.xml) and specify your Url Protocol handler method. 

 

For this example I use "abcd".  So if you run this example application and then open Safari and type a Url like, abcd://www.google.com then you will receive that message in your Delphi app.  It will automatically run your Delphi app if it is not already running.

 

You should modify your didSelectPost so that it takes the urlString and changes the HTTP/S method to use your Url Protocol Handler method and then executes OpenUrl() to open the Url Protocol Handler thereby sending the Url to your Delphi app even if your app is not running.

 

- (void)didSelectPost {
    NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
    NSItemProvider *itemProvider = item.attachments.firstObject;
    if ([itemProvider hasItemConformingToTypeIdentifier:@"public.url"]) {
        [itemProvider loadItemForTypeIdentifier:@"public.url" options:nil completionHandler:^(NSURL *url, NSError *error) {
            NSString *urlString = url.absoluteString;

            // Call your Delphi app here!!!

 

        }];
    }
}

 

 

ProtocolHandler.zip

Edited by Allen@Grijjy

Share this post


Link to post

Did some more reading here.  Apple specifically says that extensions are not allowed to launch their host application unless it's a Today widget,

"A Today widget (and no other app extension type) can ask the system to open its containing app by calling the openURL:completionHandler: method of the NSExtensionContext class. "

https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionOverview.html#//apple_ref/doc/uid/TP40014214-CH2-SW2

 

You may get rejected by Apple from the App Store for violating guidelines.  That being said, I suspect from reading on StackOverflow that is exactly what some Share extensions are doing and they are in the App store.

 

I attached an example ShareViewController.m that *may* work.  Of course you will need to modify the urlString and replace https:// with abcd:// to launch the Url Protocol handler.

 

ShareViewController.m

Edited by Allen@Grijjy
  • Like 2

Share this post


Link to post

Hi,

I created the Share extension type app in xcode and embedded it into my delphi project.

After solving all the problems described above everything works in development and ad hoc. (thanks Dave and special thanks to Allen)


But I had to remove the appex "embedded.mobileprovision" from the deployment:

 

In App Store mode

When I compile for the app store if I also enter "embedded.mobileprovision"  in deployment tthen I get this error.

 

[PAClient Error] Error: E0776 Error Domain=IDEProvisioningErrorDomain Code=9 ""yashare.appex" requires a provisioning profile with the App Groups feature." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription="yashare.appex" requires a provisioning profile with the App Groups feature., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
 

I checked the provisionings they are correct,s .   both (app and extension) supports  group

 

If I disable  "embedded.mobileprovision" for appex in deployment  then delphi compiles the ipa correctly, however, when I try to upload IPA files to the store I get this error.

 

ERROR ITMS-90164: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. According to the provisioning profile, the bundle contains a key value that is not allowed: '4WXQVJ6QJ7.it.diesys.youaddict.yashare' for the key 'application-identifier' in 'Payload/YaApp.app/PlugIns/yashare.appex/yashare'."

 

In xcode everything looks fine

 

Extension

251532958_Immagine16-08-20alle12.23(1).thumb.jpeg.42504f7176e1108aa84e5c7ac70cc74b.jpeg

 

App

1700106281_Immagine16-08-20alle12_23.thumb.jpeg.1ab0af691d4737e53919d15ac1f60bd3.jpeg

Share this post


Link to post

Update

I created the group with an administrator profile.

Now I tried to do a test by uploading an empty app to the store (instead of mine in delphi) and my real extension.

The upload worked so the problem seems to be related to delphi.

If in the deployment I also enable embedded.mobieprovisioning then Delphi gives me the error

 

[PAClient Error] Error: E0776 Error Domain=IDEProvisioningErrorDomain Code=9 ""yashare.appex" requires a provisioning profile with the App Groups feature." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription="yashare.appex" requires a provisioning profile with the App Groups feature., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}

 

If instead I exclude it then Delphi creates the IPA file for me but during loading APPLE gives me this error

 

ERROR ITMS-90164: "Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. According to the provisioning profile, the bundle contains a key value that is not allowed: '4WXQVJ6QJ7.it.diesys.youaddict.yashare' for the key 'application-identifier' in 'Payload/YaApp.app/PlugIns/yashare.appex/yashare'."

 

 

maybe there is something wrong with embedded.mobieprovisioning file or I need to change something in the Delphi deployment, I don’t Know

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×