Unable to set iOS.PList.UIBackgroundModes

After setting iOS.PList.UIBackgroundModes in the .unoproj file (and creating a fuse preview), the setting is not set in the project’s .plist file.

Fuse version 0.23.0 (build 7041) OS X El Capitan Version 10.11.6

Steps

  1. Open any of the example projects

  2. Edit the .unoproj file and change it so it matches the file below

  3. Save and preview in iOS

  4. Open the project in Xcode, go to the “Capabilities” tab, and note that “Background Modes” is OFF

    .unoproj


  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS"
  ],
  "Includes": [
    "*"
  ],
  "Mobile": {
        "Orientations": "Portrait"
  },
  "iOS": {
        "PList": {
            "UIRequiredDeviceCapabilities": [
                "camera-flash",
                "gps"
            ],
      "UIBackgroundModes": [
        "location",
        "audio"
    ]
        }
    }
}

Hey!

Thanks for your report. Looks like we haven’t added support to set that property in the unoproj yet. I’ve created an internal issue to do just that, and we’ll get back to you when that’s been done.

Cheers, Olle

Hey again!

We’ve just added this feature internally so you can expect the code above to work in a future release.

Thanks again for the report.

In the meantime, you can try using the [Require(iOS.BackgroundModes, "location"), Require(iOS.BackgroundModes, "audio")] attribute on a Uno class in your project.

Hi Olle! Thanks for creating the internal issue and for the suggestion.

I tried adding [Require(iOS.BackgroundModes, “location”), Require(iOS.BackgroundModes, “audio”)] to one of my Uno classes. Unfortunately, I get the following error when I try to preview the App:

There is no identifier named 'iOS' accessible in this scope. Did you mean 'iOS' (as in Fuse.Triggers.iOS)? For example, try adding 'using Fuse.Triggers;' to the top of the code file. Could you be missing a package referece?

Oops, typo! That should be [Require("iOS.BackgroundModes", "location")] and similarly for the others.

Cheers!

Thanks Olle - that’s it!