Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Various Xcode 9 fixes - #10055

Merged
frederoni merged 5 commits into
masterfrom
fred-xcode9-fixes
Oct 3, 2017
Merged

frederoni merged 5 commits into
masterfrom
fred-xcode9-fixes

Conversation

@frederoni

@frederoni frederoni commented Sep 25, 2017 •

Copy link
Copy Markdown
Contributor

Fixes compilation for Xcode 9

  • Replaced deprecated method
  • Obj-C method description name is optional in Swift as of Xcode 9.
  • Stricter indirect values (Color.getRed:green:blue)
  • Fix backwards compatibility

@kkaefer @boundsj 👀

@frederoni
frederoni force-pushed the fred-xcode9-fixes branch 2 times, most recently from 1aa5f48 to add9a7d Compare September 25, 2017 12:46
@friedbunny friedbunny added build iOS Mapbox Maps SDK for iOS labels Sep 25, 2017
@boundsj

boundsj commented Sep 25, 2017

Copy link
Copy Markdown
Contributor

Tagging in @friedbunny and @fabian-guerra

typealias MGLColor = NSColor
#endif

#if swift(>=3.2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd they haven’t allowed < to work for this. 🤷‍♂️

@friedbunny

friedbunny commented Sep 26, 2017 •

Copy link
Copy Markdown
Contributor

There are still a few failures locally for me under Xcode 9:

Test Case '-[MGLStyleValueTests testFunctionsWithDataDrivenProperties]' started.
/mapbox-gl-native/platform/darwin/test/MGLStyleValueTests.swift:270: error: -[MGLStyleValueTests testFunctionsWithDataDrivenProperties] : XCTAssertEqual failed: ("Optional(<MGLCompositeStyleFunction: 0x7ffbd9ddd2b0,             interpolationMode = 2,             stops = {
    0 =     {
        green = 5;
    };
    10 =     {
        green = 5;
    };
    20 =     {
        green = 20;
    };
    15 =     {
        green = 20;
    };
},             attributeName = color,             defaultValue = 2,             interpolationBase = 1.000000>)") is not equal to ("Optional(<MGLCompositeStyleFunction: 0x7ffbd9dd4cf0,             interpolationMode = 2,             stops = {
    20 = (null);
    0 =     {
        green = 5;
    };
    10 = (null);
    15 = (null);
},             attributeName = color,             defaultValue = 2,             interpolationBase = 1.000000>)") - 

XCTAssertEqual(circleStyleLayer.circleRadius, expectedCompositeCategoricalValue)


*** Assertion failure in NSObject *MGLStyleValueTransformer<float, NSNumber *, float, NSNumber *>::toRawStyleSpecValue(MGLStyleFunction<ObjCType> *__strong) [MBGLType = float, ObjCType = NSNumber *, MBGLElement = float, ObjCEnum = NSNumber *]_block_invoke(), /mapbox-gl-native/platform/darwin/src/MGLStyleValue_Private.h:289
/mapbox-gl-native/platform/darwin/test/MGLStyleValueTests.swift:284: error: -[MGLStyleValueTests testFunctionsWithDataDrivenProperties] : failed: caught "NSInternalInconsistencyException", "Stop outputs should be MGLConstantStyleValues”

circleStyleLayer.circleRadius = expectedCompositeExponentialValue


Test Case '-[MGLNSStringAdditionsTests testTitleCasedString]' started.
/mapbox-gl-native/platform/darwin/test/MGLNSStringAdditionsTests.m:23: error: -[MGLNSStringAdditionsTests testTitleCasedString] : (([@"Improve a map" mgl_titleCasedStringWithLocale:locale]) equal to (@"Improve a Map")) failed: ("Improve A Map") is not equal to ("Improve a Map")
Test Case '-[MGLNSStringAdditionsTests testTitleCasedString]' failed (0.137 seconds).

XCTAssertEqualObjects([@"Improve a map" mgl_titleCasedStringWithLocale:locale], @"Improve a Map");

@friedbunny

Copy link
Copy Markdown
Contributor

Let’s split 4fcdb39 and the ios-sim stuff off into its own PR(s) — will be easier to approve/merge and track in the future.

@boundsj

boundsj commented Sep 28, 2017

Copy link
Copy Markdown
Contributor

6618985 works around Swift → ObjC bridging issues that I don't yet understand. The gist is that the nested dictionaries required for composite functions don't transfer from Swift to ObjC correctly nowadays. I'm not sure when I'll have time to revisit this but I think it may be ok to merge 6618985 for now to make the tests pass again.

I'm not sure about MGLNSStringAdditionsTests check of XCTAssertEqualObjects([@"Improve a map" mgl_titleCasedStringWithLocale:locale], @"Improve a Map");. Pre Xcode 9 the result of the call to mgl_titleCasedStringWithLocale: is @"Improve a Map". Xcode 9 and later the result is @"Improve A Map" with a capital "A". @1ec5 can you please investigate this one?

@1ec5

1ec5 commented Sep 29, 2017 •

Copy link
Copy Markdown
Contributor

Pre Xcode 9 the result of the call to mgl_titleCasedStringWithLocale: is @"Improve a Map". Xcode 9 and later the result is @"Improve A Map" with a capital "A".

“A” appears to be tagged as NSLinguisticTagOtherWord, whereas it’s more specifically tagged as NSLinguisticTagDeterminer in iOS 10 and macOS 10.12.

@1ec5

1ec5 commented Sep 29, 2017

Copy link
Copy Markdown
Contributor

4e89282 enumerates the string’s lexical classes (parts of speech) according to the passed-in locale’s default orthography. +[NSLocale defaultOrthographyForLanguage:] is only available in iOS 11 and macOS 10.13, so I had to enclose it in a +respondsToSelector: check. Xcode 9 wants me to use @available instead, but the iOS build bot is currently on Xcode 8.3, so I had to suppress that warning.

@boundsj boundsj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good enough to merge, to me.

@friedbunny @fabian-guerra @1ec5 what do you think?

@frederoni
frederoni merged commit 42b4818 into master Oct 3, 2017
@frederoni
frederoni deleted the fred-xcode9-fixes branch October 3, 2017 11:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

build iOS Mapbox Maps SDK for iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants