iOS: Optional framework import

Hello,

how can I make my app available for iOS >= 9.3 when using the new framework “UserNotifications” (since iOS10)?
For sure, I need to check the actual version to distinguish how I fire notifications:

if not (UIDevice.currentDevice.systemVersion.compare('10.0') options(NSStringCompareOptions.NSNumericSearch) = NSComparisonResult.NSOrderedAscending) then

But the problem is that as soon as I add the reference to my project <Reference Include="UserNotifications" />, the app won’t be runnable anymore (will crash at startup). Of course that makes sense because there can’t be found such framework. Therefore I imagined something like

{$IFDEF IOS10}
<Reference Include="UserNotifications" />
{$ENDIF}

But I guess this constellation isn’t available :smiley:
Is there any possibility to solve this problem?

Thanks and regards

Benjamin

I think I need to do something like

<ItemGroup Condition="'$(iOS)' >= '10.0'">
    <Reference Include="UserNotifications" />
</ItemGroup>

That won’t do what you think it does. i believe you can just reference the framework, and just make sure you have the proper checks around when you call it (e.g… using if available("iOS 10.0")).

Nah, won’t work :frowning: Just referencing the framework without any usage will make the app crash…

Ok, we’ll need to look at supporting this properly then.

Thanks, logged as bugs://77980

Still not fixed, right?

it yet no. sorry. i’ll check with the team tomorrow if we can expedite this for 9.2.