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

Zigii Wong
  • 7,766
  • 8
  • 51
  • 79
  • 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"`. – Martin R Sep 07 '15 at 07:23
  • I have no idea why all generated code of string is start with `\U`, and after I fix it to `\u`, it works. – Zigii Wong Sep 07 '15 at 07:50
  • @MartinR Another point is why the demo of WWDC 2015 is string rather than unicode ? https://developer.apple.com/videos/wwdc/2015/?id=406 – Zigii Wong Sep 07 '15 at 08:48
  • 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. – Martin R Sep 07 '15 at 08:50

2 Answers2

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.

Thorax
  • 2,352
  • 1
  • 22
  • 27
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

Community
  • 1
  • 1
Edward Chiang
  • 1,133
  • 2
  • 12
  • 24