App translocation and TestFlight

Hi,

We have an app that installs a number of system extensions. According to this documentation the app must be located in the Applications folder to be activated so when the app launches we check that it is running from /Applications (or a subfolder) and if it isn't we inform the user and exit. This has been working fine until a recent submission whereupon installing the app via TestFlight casuses it to be translocated when run and our check to fail. So, a couple of questions:

Is it expected that an app installed via TestFlight (or indeed the AppStore) can be translocated when it is run? If yes to the above, how can we ensure that out app is running from Applications and can therefore activate its extensions?

Thanks Alan

Is it expected that an app installed via TestFlight … can be translocated when it is run?

No.

Are you able to reproduce this on a ‘clean’ machine? That is, a machine that’s never seen your app before? I usually run tests like this on a VM, restoring from a snapshot between each test.

Share and Enjoy

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

Thanks Quinn

Are you able to reproduce this on a ‘clean’ machine? That is, a machine that’s never seen your app before? I usually run tests like this on a VM, restoring from a snapshot between each test.

We'll try, but it may be difficult as all our VMs are on Apple silicon and can't login with an Apple Id.

This issue first arose when one of our clients submitted an update for review and App Review were unable to run it due to the check I mentioned above. The client had recently updated their provisioning profile after the previous one expired - could this have been a trigger for App Translocation?

One question - if an app is translocated, can it still activate its system extensions given the requirements in this documentation? If so, we may be able to run our app regardless of translocation status and remove the check,

Thanks Alan

could this have been a trigger for App Translocation?

That seems unlikely. Translocation is normally triggered by quarantine, which is far removed from provisioning profile side of things.

if an app is translocated, can it still activate its system extensions … ?

I don’t know, but I agree that it’s something to be concerned about. It seems like you have everything in place to test this for yourself. What happens if you try this?

Share and Enjoy

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

We were able to test and replicate this on a clean machine that had never had the app installed. This was again via TestFlight.

I don’t know, but I agree that it’s something to be concerned about. It seems like you have everything in place to test this for yourself. What happens if you try this?

Is it possible to add the quarantine flag to an app so as to try and replicate the translocation issue? If not, I think we would have to go through the submission process as this has only occurred so far during App review.

We were able to test and replicate this on a clean machine that had never had the app installed. This was again via TestFlight.

… If not, I think we would have to go through the submission process as this has only occurred so far during App review.

I’m misunderstanding something here. If you can replicate the issue, how is it that it only occurs during App Review?

Is it possible to add the quarantine flag to an app so as to try and replicate the translocation issue?

There’s no command-line tool to do this, sadly [1], but the quarantinePropertiesKey resource value key lets you set quarantine on a file. It take a dictionary value, and here’s an example of how you might set that up for testing purpose:

let value = [
    kLSQuarantineAgentNameKey as String: bundleName,
    kLSQuarantineAgentBundleIdentifierKey as String: bundleID,
    kLSQuarantineTypeKey as String: kLSQuarantineTypeWebDownload,
    kLSQuarantineOriginURLKey as String: URL(string: "https://example.com/")!
]

You’ll need to set the property on every items in the app bundle, not just the top-level .app directory.

Share and Enjoy

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

[1] I actually wrote my own tool for this, based on the above-mentioned API.

For those following along at home, I’ll be helping AlanC74 in a different context.

Share and Enjoy

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

App translocation and TestFlight
 
 
Q