0

I would like to use 2 diffrent Info.plist files - one for iOS 8 and another one for iOS 9. Is it possible?

Specifically, I would like to set plist value of RequestsOpenAccess under NSExtensionAttributes to true on iOS 8 and to false on iOS 9. How can I do that?

Please note: While questions asking for the same exists answers generally recommend using mechanism other than plist to differenciate between versions. I do not think that could be applied in my case (I would be happy if somebody proves me wrong).

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Rasto
  • 17,204
  • 47
  • 154
  • 245

2 Answers2

3

No, it's not possible. You would have to build and distribute two separate apps, as @Dschee says in his comment.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • Thank you. Could you provide some reference (does not have to be Apple documentation)? If not your SO rep certainly gives you some authority but reference would be appreciated. – Rasto Mar 25 '16 at 00:26
  • 1
    I'll confirm this answer. A packaged app can only have one Info.plist. When a user downloads your app, they get the one app that can run on all versions of iOS supported by your app. They don't get the "iOS 8 version" or the "iOS 9" version. They get the one version. – rmaddy Mar 25 '16 at 00:32
  • 1
    I don't have any references that say an app can't have 2 different info.plist files. That is a bit like asking for a reference confirming that turtles don't fly. It is the way app bundles are designed. – Duncan C Mar 25 '16 at 02:03
2

What about you configure your target to one of the two (say iOS 9), then duplicate it, change the second target up to use iOS 8 and also change its Info.plist file path in the build settings?

This way you can configure two separate .plist files for two separate targets. You would then also need to deploy two separate apps though.

Would this solve your problem?

Community
  • 1
  • 1
Jeehut
  • 20,202
  • 8
  • 59
  • 80
  • Interesting idea... It would work for me if I can somehow ensure that the first target would be ignored on iOS 8 and second would be ignored by iOS 9. I think both of those cannot be done with Deployment Target project property alone. – Rasto Mar 25 '16 at 00:16
  • I think you would have to create two separate apps in order for this to work. If that's not a feasible option for you then you might be out of luck. – Jeehut Mar 25 '16 at 00:18
  • No - creating 2 separate apps is not an option... However, creating 2 targets and limiting one to iOS 8 and the other one to iOS 9 certainly would be an option (only I do not know how to do it). Btw. do you know if it is posible to change plist in runtime? – Rasto Mar 25 '16 at 00:21
  • 1
    By setting your minimum iOS deployment version (in build settings) to iOS 9 you effectively create an iOS 9-only version. That won't help you without two separate apps though. About changing the Info.plist at runtime, I think that's not possible. Refer also to http://stackoverflow.com/a/12818184/3451975 – Jeehut Mar 25 '16 at 00:24
  • This solution has many flaws. The main one being that the "iOS 8" version will also be installable on iOS 9 and higher devices too. You can't create an "iOS 8 only" app. iOS doesn't support such a thing. – rmaddy Mar 25 '16 at 00:35
  • @rmaddy: Although it is technically correct what you are saying it might still make sense to release app "A" that supports iOS 8 devices and app "B" that doesn't support them (starting at iOS 9) separately. This way a user with a device running iOS 8 has the option to install app "A" and get the iOS 8 behavior if he wants to. iOS 9 users would then be pointed to install app "B" if they wanted the altered behavior or could keep app "A" as they wish. – Jeehut Mar 25 '16 at 00:51
  • @Dschee But if an iOS 9 user installs the "iOS 8" version, they get the wrong value for the `RequestsOpenAccess ` Info.plist entry. Not what the OP wants. – rmaddy Mar 25 '16 at 00:52
  • @drasto, it is not possible to change the info.plist at runtime. It is stored in the app bundle, which is read only and cryptographically signed. If you modify the app bundle, it won't launch. – Duncan C Mar 25 '16 at 02:05
  • @DuncanC I understand that. I was hoping that iOS keeps a "loaded/in memory" copy of info.plist when app is running and perhaps even gives the app write access to it. So I would be able to change some keys in plist efectively used (the "in memory plist") during each app startup. If that is not so, I guess I will just have to set `RequestsOpenAccess ` to true for all versions and bother users with it even through the app does not really need it on iOS 9... – Rasto Mar 25 '16 at 02:40