Travis error for @available command in iOS

67 Views Asked by At

I am running an issue with Travis and Fastlane (Gym) and I haven't found a way of fixing it.

I added a new dependency through Cocoapods and all works fine in my device but when I run it through Travis it encounters the following errors:

no known class method for selector 'labelColor' no known class method for selector 'systemBackgroundColor' no known class method for selector 'secondarySystemBackgroundColor'

In these places, there's an @available macro because they don't exist in iOS versions under 13.

if (@available(iOS 13.0, *)) {
        return [UIColor labelColor];
    } else if ([self isDarkColor:[self getBackgroundColor:config]]) {
        return [UIColor whiteColor];
    }

So why is it failing in Travis? And how to avoid it?

What I did now is to define Xcode11.1 in the yaml file, but this hasn't fixed the issue yet. Is there a way I can specify to run it only for iOS 13?

I added the following and still fails:

osx_image: xcode11.1
language: objective-c
xcode_destination: platform=iOS Simulator,OS=13,name=iPhone X

Thanks!

1

There are 1 best solutions below

2
On

You appear to have a typo in your yaml file.

Per the travis documentation for Xcode 11:

os_image: xcode11.1

Remove the x from the value that you posted.