I'm just wondering if there is an easy way to have my app extension attached to debugger after the containing app is launched. So right now I hit run button then go to Debug menu and attach my process. Is there a way to automate this process to have my app extension attached after I run the containing app?
At the moment there are no other solutions than the one mentioned in the question
Related
Appium has a way to inspect the view hierarchy of an app using an inspector. I am interested in building one myself.
I know the overview answer of: it uses some webdriver to accomplish this. But how?
It puzzles me that a separate iOS app can some how communicate to another app, and show even its screen.
How does it work under the hood? or how does the iOS app communicate to the UI inspector to send its screen shots and hierarchy?
It puzzles me that a separate iOS app can some how communicate to another app, and show even its screen.
Yes! Apps should not be able to do this. But there exists a special kind of app, built just for testing, which IS able to do this.
The way this is done is using Apple's XCUITest framework. When you write an XCUITest in XCode, it builds a special app which is able to start your test app and then communicate with it using the XCUITest methods. These methods allow you to inspect elements in the view.
In order to create a view tree, you start at the root view and iterate over the children, building out a tree with a tree traversal.
Normally, the XCUITest app exits when your test script finishes, which means you won't be able to access it from a desktop app for viewing the tree as it updates. If you write your test script to run an infinite loop and open a network port for communication with an outside process, now you can build your viewer. This is exactly what Appium does, so I suggest you check out the appium source code and maybe just use that?
More information in this blog post
[edit]: Oh yeah, Appium uses Feacebook's WebDriverAgent project as the script that runs on the app. So WebDriverAgent is basically an XCUITest script which runs a server and can take commands during a test. Appium does a ton of work to bundle and package it into the special kind of companion app that is able to access your app, installs it on the iOS device, and then runs the test. WebDriverAgent has a command which iterates over the UIHierarchy and returns the whole tree.
I'm building a Siri aka Intents extension.
I do understand that I can attach the debugger to a running process after start, however, I never see my process. I do have the authorization for my app set to active and the extension must be running at least for some time, Siri is showing clear responses.
By the Apple documentation, you should run the Extension Scheme with Siri as host app. However, if I try that nothing happens on the device, it's waiting to attach for ever. Apple mentions the first connection can take "several minutes", but not hours ...
Any idea where I'm going wrong or how to achieve a connection to the debugger? Or at least some console output?
just select your siri extension scheme and hit run button, then xcode will prompt a list of applications for you to choose, just choose your app, for more details, please checkout the article:http://jamesonquave.com/blog/adding-siri-to-ios-10-apps-in-swift-tutorial/
Run your app in device first.
Select SIRIKIT extension scheme run in your device, select your app from the list prompted.
Wait for SIRI to be active, send your running SIRIKIT extension into background.(Some times you need not to do this step also).
Activate SIRI by pressing home button again, give a command and you will see your breakpoints working inside Intent Handler.
In my case, Xcode 13.X, iOS15
Change target to you intent extension
Run extension and choose your App
After App launch, trigger your shortcut(you can use Siri or just tap shortcut)
You will see your breakpoints working inside Intent Handler
I tried all the ways and it didn't work I think it's because I have a mac too old (2010) and has no ability to process.
This is a very hack solution to debug but it works.
Create a webhook using this site https://webhook.site
Then if you want to check if you code was in some point just add this code:
(Don't forget to change the URL for the same that you received webhook)
let url1 = URL(string: "https://webhook.site/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/your_code_was_here")!
let task1 = URLSession.shared.dataTask(with: url1)
task1.resume()
Then you just need to look again at the webhook site to see if the GET request got there.
I'm writing a basic application using xcode 5.1. One of the features I'm interested in trying to do is to launch another app or move to other part of iphone, INSIDE the app already running.
Eg. I have an app with 3 menu options, 1 and 2 do certain tasks as part of this parent app, menu option 3 launches another app that's installed on the phone. I'm not sure if this is possible?
No you can not do that. Besides the documented URL handlers, there's no way to communicate with/launch another app.
This is part of the sandbox principle of apple:
https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/TheiOSEnvironment/TheiOSEnvironment.html
What you can do is launch another app by using custom URL-Schemes
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-working-with-url-schemes/
I know you can tell the iOS Simulator to quit with applescript. Can you tell it to go "home" from the current app? And then click on the app's icon to relaunch it? This would be useful for me for Application Tests that need to verify background tasks complete and numerous other cases.
Any AppleScriptable app must export a scripting dictionary in order for AppleScript to know what its commands are. You can see any app's dictionary by opening the app in Script Editor.
Note that even if an app doesn't provide script commands for what you want, System UI Scripting or Automator can likely still be used to drive its UI. (For example, to choose the Home or Rotate commands in iOS Simulator's menu bar.)
There's also iOS-specific UI automation stuff you can do from the Instruments app that comes with Xcode.
The iOS Simulator does not directly support AppleScript. It doesn't have a scripting dictionary. This means that the only real way to manipulate it in AppleScript is to use the UI commands that work for any application.
My iPad app opens PDF files handed to it from other apps. However, when another app calls it to open, my app launches and starts from scratch, causing the user to log in again and lose their place within the program. Is there any way to open the already running instance and open the given file within it?
You should be implementing application:handleOpenURL:.