Highlighted

iOS 8 Today Widget

New Here ,
Jan 19, 2015

Copy link to clipboard

Copied

Hi everyone,

I'm working on a iOS 8 Today Widget going along with an AIR app and facing a "app to widget" communication issue.

The project consists of:

  • an AIR app embedding an ANE that sets data to a NSUserDefaults object
  • and an XCode project
    • defining the Widget storyboard
    • Executing an hacky custom Shell script to "merge" the widget into an existing .ipa (coming from Flash Builder)
      • pushd ../builds

        unzip MyApp.ipa

        cp -r Payload/MyApp.app/* "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/"

        rm -r Payload

        popd

When running the app from XCode on the device:

  • the widget appears in the iOS Widgets panel
  • the communication between the AIR app and the widget does work

But when exporting an .ipa (with Product > Archive > Export), then installing it manually (via iTunes):

  • the widget appears in the iOS Widgets panel
  • the communication between the AIR app and the widget doesn't work


I only get the following warning when doing "Archive", but couldn't figure out why nor if it's related.

warning: skipping copy phase strip, binary is code signed: /Users/[...]/UninstalledProducts/TodayExtension.appex/TodayExtension

Would anyone have already experienced that issue?

Any suggestion or idea are more than welcome.

Florian

TOPICS
Development

Views

742

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

iOS 8 Today Widget

New Here ,
Jan 19, 2015

Copy link to clipboard

Copied

Hi everyone,

I'm working on a iOS 8 Today Widget going along with an AIR app and facing a "app to widget" communication issue.

The project consists of:

  • an AIR app embedding an ANE that sets data to a NSUserDefaults object
  • and an XCode project
    • defining the Widget storyboard
    • Executing an hacky custom Shell script to "merge" the widget into an existing .ipa (coming from Flash Builder)
      • pushd ../builds

        unzip MyApp.ipa

        cp -r Payload/MyApp.app/* "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/"

        rm -r Payload

        popd

When running the app from XCode on the device:

  • the widget appears in the iOS Widgets panel
  • the communication between the AIR app and the widget does work

But when exporting an .ipa (with Product > Archive > Export), then installing it manually (via iTunes):

  • the widget appears in the iOS Widgets panel
  • the communication between the AIR app and the widget doesn't work


I only get the following warning when doing "Archive", but couldn't figure out why nor if it's related.

warning: skipping copy phase strip, binary is code signed: /Users/[...]/UninstalledProducts/TodayExtension.appex/TodayExtension

Would anyone have already experienced that issue?

Any suggestion or idea are more than welcome.

Florian

TOPICS
Development

Views

743

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 19, 2015 0
Engaged ,
Mar 04, 2015

Copy link to clipboard

Copied

Wow I'm very interested in helping out here as we're facing a similar request from one of our clients.

Can you tell me how you got the app extension to merge with your AIR application? Everything I've tried so far has failed. Is the MyApp.ipa generated from your AIR application?

air native extensions // https://airnativeextensions.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 04, 2015 0
Flo13 LATEST
New Here ,
Mar 05, 2015

Copy link to clipboard

Copied

Hi Michael,

The rough idea is to merge 2 ipa:

  • the first one contains your app and is built with your usual IDE
  • the second one is built by XCode (with both targets, your app and the TodayExtension)
  • XCode then merges both ipas with the following script (add a "Run script" in "Build Phase" tab):

    pushd ../builds                                                         // indeed, change that path according to your App.ipa location

    unzip App.ipa

    cp -r Payload/App.app/* "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/"

    rm -r Payload

    pushd "${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/"

    rm CodeResources

    ln -s _CodeSignature/CodeResources CodeResources

    popd

  • You need to activate App Groups in Capabilities setting your app group id (usually looking like that: group.domainName.appName)
  • Your original ipa needs to init an ANE with the same app group id:

    self.data = [[NSUserDefaults alloc] initWithSuiteName:"group.domainName.appName"];

    [self.data synchronize];

  • That ANE will also set data to the UserDefault object:

    [data setObject:@"your_value" forKey:@"your_prop"];

  • Your Widget code can then get data doing (the following is in swift):

    var userDefaults = NSUserDefaults(suiteName: "group.domainName.appName")

    userDefaults?.synchronize()

    var prop = userDefaults?.stringForKey("your_prop")

Every time you open the Today Widget panel on your phone, it will get the data object that's been set by the ANE, and refreshes your UI.

By the way, our above issue was just a typo in our app group id. Our widget now works properly.

I'm gonna see with my company if we can share our UserDefaults.ANE and I'll let you guys know.

Best,

Florian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2015 0