Test iOS9 SDK using Swift with older SDK version

128 Views Asked by At

I faced with a problem during writing test for the ForceTouch. My app is available for iOS8-9. I write @available(iOS 9.0, *) in my develop target and it works fine in iOS8 and its just ignored by compiler. But I catch the exception: Symbol not found: _OBJC_CLASS_$_UIApplicationShortcutItem on test target. I know that macros don't work on Swift.

NSProcessInfo.processInfo().isOperatingSystemAtLeastVersion

the compiler ignores too. The question is how to test methods from iOS9 SDK if your app available for older version iOS too?

1

There are 1 best solutions below

0
On

I had a similar problem.

This fixed it for me, make sure the deployment target is iOS8 also on your Test Target.

enter image description here