iOS Thumbnail Extension vs Network access

Is it possible to use network from within iOS Thumbnail Extension? I tried - it works fine under simulator, but I'm getting this error when running on real device:

networkd_settings_read_from_file Sandbox is preventing this process from reading networkd settings file at "/Library/Preferences/com.apple.networkd.plist", please add an exception.

Adding "App Transport Security Settings / Allow Arbitrary Loads" plist entry didn't help. As the error seems to be specific access to a particular file I tried adding "com.apple.security.temporary-exception.files.absolute-path.read-only" but it didn't help and looks like it couldn't help on iOS: "Note: This chapter describes property list keys specific to the macOS implementation of App Sandbox. They are not available in iOS."

Answered by DTS Engineer in 708664022

It sounds like Quick Look is running your extension in a custom sandbox that doesn’t support networking. iOS has no mechanism to customise your sandbox [1], which means you’re pretty much out of options here. Well, I guess you could file a bug requesting that this restriction be lifted but I’m not sure that’ll go anywhere. While I wasn’t involved in this specific decision, my general experience with these sorts of extensions is that they are deliberately put in a tight sandbox.

If you do file a bug, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] As you correctly determined, the temporary exception entitlements only apply to the App Sandbox on macOS.

Accepted Answer

It sounds like Quick Look is running your extension in a custom sandbox that doesn’t support networking. iOS has no mechanism to customise your sandbox [1], which means you’re pretty much out of options here. Well, I guess you could file a bug requesting that this restriction be lifted but I’m not sure that’ll go anywhere. While I wasn’t involved in this specific decision, my general experience with these sorts of extensions is that they are deliberately put in a tight sandbox.

If you do file a bug, please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] As you correctly determined, the temporary exception entitlements only apply to the App Sandbox on macOS.

I see, thank you.

That it worked under simulator gave me a false hope and I was following the fool's gold for quite some time now :-(

I need to generate an image for a remote video URL (without downloading the whole video upfront). Natural way to do this - using AVAssetImageGenerator. The attempt to use thumbnail extension for that purpose (along with my custom scheme involving creating a temporary local file with a custom extension, and passing the original video URL to the thumbnail extension) was done to run AVAssetImageGenerator in a process of its own, as I found that calling AVAssetImageGenerator's copyCGImage / generateCGImagesAsynchronously on a background thread still causes some unwanted activity happening on the main thread 😡.

As I can not just spawn a new process directly under iOS (can I?):

  • is there any other app extension suitable for the task of using network + asset image generation code and somehow returning the resulting image to the main app process?

  • is there any other way to mitigate AVAssetImageGenerator unwanted main thread usage issue?

As I can not just spawn a new process directly under iOS (can I?):

You cannot.

Using a thumbnail generator to work around an AVFoundation issue seems… well… creative. I recommend that you tackle the AVFoundation issue head on. I can’t help you with that, alas. It’s way outside of my area of expertise. I recommend one (or both) of the following:

  • Repost on here DevForums with tags that are more likely to attract media subsystem experts.

  • Open a DTS tech support incident and get one-on-one help from one of our media folks.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS Thumbnail Extension vs Network access
 
 
Q