3

Background

I have a fairly detailed (around 2000 lines of swift code) automation framework built with Xcode 7.3 and Swift for our iOS app.

Up till a recent point, I was able to use lldb to build my framework i.e

  • insert breakpoint and run code up till that point
  • use po XCUIApplication().debugDescription and expr bla bla to build the logic
  • repeat

Problem

Pretty much all of a sudden, I now encounter the following error whenever running anything inside lldb's console:

(lldb) po XCUIApplication()
error: <EXPR>:2:1: error: 'XCUIApplication' is only available on iOS 9.0 or newer
XCUIApplication()
^
<EXPR>:2:1: note: add 'if #available' version check
XCUIApplication()
^
<EXPR>:2:1: note: add @available attribute to enclosing instance method
XCUIApplication()
^
<EXPR>:2:1: note: add @available attribute to enclosing extension
XCUIApplication()
^
<EXPR>:10:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it
    var $__lldb_error_result = __lldb_tmp_error
    ~~~~^~~~~~~~~~~~~~~~~~~~

Notes

Googling and research has not gotten me anywhere significant. The one relevant thread I found was in the fastlane project. Unlike that comment, mine is a UI Test target. Also, the test target's "iOS Deployment Target" is set to iOS 9.2 (in case that helps).

  • To the extent I remember, I haven't changed anything significantly in recent times.
  • My device is (and has always been) iOS 9+.

What could be going wrong?

Update 20 May 2016

Some exploration based on the answer below: https://stackoverflow.com/a/37335950/682912

  • The issue happens only on real devices. Simulators do not face this problem.
  • On real device (iPhone 6S+, iOS 9.2.1), I did a full reset of Content and Settings. This did not fix the issue.
Community
  • 1
  • 1
Vish
  • 2,144
  • 5
  • 25
  • 48
  • Are you running on a device or simulator running below iOS 9? – Oletha May 19 '16 at 17:22
  • Within the debugger, try some of the method calls here to verify the OS version: [http://stackoverflow.com/questions/3339722/how-to-check-ios-version](http://stackoverflow.com/questions/3339722/how-to-check-ios-version) – bneely May 19 '16 at 19:26
  • @Oletha as mentioned, it's iOS 9+ (9.2.1). @bneely `po NSProcessInfo().operatingSystemVersion` returns `▿ NSOperatingSystemVersion - majorVersion : 9 - minorVersion : 2 - patchVersion : 1` i.e 9.2.1. – Vish May 20 '16 at 03:33

2 Answers2

3

This is a bug in the debug agent installed on your device. These are bound to the iOS version, so it probably happened when you upgraded your device. Anyway, please file a bug with http://bugreporter.apple.com.

If I'm right about the problem, it should only happen when debugging to the device, not on the simulator. That might allow you a temporary workaround till the bug gets fixed.

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • 1
    "it should only happen when debugging to the device, not on the simulator." Let me try this out and update this. – Vish May 20 '16 at 03:42
  • Update: you are right! `(lldb) po XCUIApplication() t = 43.01s Snapshot accessibility hierarchy for com.crunch.CrunchCastQA.iOS Attributes: Application 0x7ffedce003c0: {{0.0, 0.0}, {414.0, 736.0}}, label: 'Foo' Element subtree: ` Apart from filing a bug report, is there anything I can do? Will resetting content and settings help? – Vish May 20 '16 at 04:21
  • Update: resetting content and settings did not help. – Vish May 20 '16 at 04:40
  • Probably need more info before we can suggest a workaround. Best to do that through the bug report. – Jim Ingham May 20 '16 at 16:20
0

Double check your .xcconfig with your test target or any other means that may set your IPHONEOS_DEPLOYMENT_TARGET to lower than 9.0. Since UITest is only available on iOS9.0 or later, change IPHONEOS_DEPLOYMENT_TARGET to 9.0+ should fix the issue.

fruitmoona
  • 71
  • 1
  • 3