Incomplete universal character name in UI Testing
Asked Answered
L

2

13

I am using Xcode 7's new feature : UI Testing. After recording the interaction, Xcode generated the code automatically :

- (void)testDoubleTapToolBarItem {
    [[[XCUIApplication alloc] init].tabBars.buttons[@"\U5173\U6ce8"] doubleTap];
                                                    ~~~~~~~~~~~~~~~~
}

However, warning showed as well. Any one know how to fix this?

Incomplete universal character name


Edit: This seems to be a BUG since Xcode 7.0 GM

Laurenalaurence answered 7/9, 2015 at 6:5 Comment(4)
If that has been generated by Xcode then it is a bug. Unicode escape sequences in Objective-C string literals are either \uNNNN or \UNNNNNNNN, in your case @"\u5173\u6ce8" or @"\U00005173\U00006ce8".Kus
I have no idea why all generated code of string is start with \U, and after I fix it to \u, it works.Laurenalaurence
@MartinR Another point is why the demo of WWDC 2015 is string rather than unicode ? developer.apple.com/videos/wwdc/2015/?id=406Laurenalaurence
I haven't done the new UI testing yet, so unfortunately I cannot help you here. (I just know how Objective-C string should look like.) If you think it is a bug then you should report it at bugreporter.apple.com.Kus
B
30

You can use the following workaround as this seems to be a bug in xcode:

replace all \U to \u and it should work.

Benildas answered 1/10, 2015 at 12:35 Comment(0)
B
1

I tried replace \U to \u but still got error "Expected hexadecimal code in braces after unicode escape", so have to add \u{you value here}, like collectionViewsQuery.buttons["\u{6ce8}\u{518c}"].tap()

See more at Expected hexadecimal code in braces after unicode escape

Bassarisk answered 11/11, 2015 at 6:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.