iOS8 - is there an example of UIAutomation framework from code? - ios

I've been reading about UI automation using instruments, and the old documentation suggested that this is done using a javascript library to access frontmost app, then access UI view hierarchy.
I see that an iOS8 device has "Enable UI automation" option in the developer menu in settings. I also see that there's some documentation on the UIAutomation framework in iOS8, which seems to me like it allows to do UIAutomation from code.
Are there examples of using iOS8 UIAutomation framework from code that I can look at to understand if this is the framework for me?
I see this screen when looking for the info on UIAutomation framework, and I think it confused me into thinking that it is available in Obj-c or Swift, because of buttons on top. Can someone confirm that this framework is NOT available in either swift or Obj-c and is still a javascript framework?
.

I believe UIAutomation is still a JavaScript only testing framework. We would have heard otherwise at WWDC or in the release notes, if any other language was supported.
Concrete evidence of this however, is that the "Automation" Instrument used when profiling an app has no language drop downs to indicate another language is possible (like say, you do when creating a new class in Xcode and there's a drop-down for Swift and Objective-C).
If you use the automatic recording functionality built into the Automation Instrument, the code you see is JavaScript. The lack of options to select another language is telling. Instruments did get a minor visual tweak with Xcode 6 too, and this fact did not change.
The UIAutomation framework, sadly doesn't seem to get a lot of love of late (not much of anything has changed since the release in 2010 with iOS4, leading some to speculate there's a major revamp in the works or it's being forgotten).
To see what JavaScript code looks like that's aimed at writing tests for iOS, check out Alex Vollmer's Tuneup JS library: http://www.tuneupjs.org. His library provides a higher level abstraction, while still in JavaScript, over Apple's UIAutomation JavaScript classes.
He has a sample project linked there that runs tests on Apple's own UICatalog example application.
Using a library like Tuneup JS is a better way to go than the more primitive JavaScript classes that Apple provides, which are really just a starting point.

You should look into Subliminal. It's a testing framework which is built on top of UIAutomation that allows you write your tests in Objective C or Swift.
https://github.com/inkling/Subliminal

We have UIAutomation working in iOS 8 using the Illuminator framework (which I wrote), and use it in our CI. It is a set of extensions to the Javascript that UIAutomation provides.
Currently, Javascript is the only language for UIAutomation that Apple supports.

Related

Known issues for iOS modularized approach?

We've a classic iOS application which was developed using objective-c and it has lot of features. The same features has been used for other similar apps as well.
Now we've plan to rewamp the entite application. One of the approach to reduce the development work, we've plan to modularize features as framework re-using the same objective-c code, so that all applicaiton can use the framework and compile time will be less.
Also as part of rewamp, we will be using iOS 10 and swift3.
Please kindly share me your ideas/feedback, what are issues will be popup or any limitaion to do this approach.
Appreciate your help!
Thanks,
Srini
Just pack it as cocoapods and deploy into your company git is the fastest way i suppose, packing into framework is also fine but it have many boilerplate thing like cant run on either device or simulator, and if using fat framework then need to extract the simulator part out when you archive, or have to use embed framework if they are depent on each other,.... its just pretty annoying

Can Xcode 7 UI Testing be used for app file alone, without its code?

I have a few app/ipa files. Using instruments ui automation i could perform actions using a js file and a terminal command. Did nt need the code/project of app file. But from Xcode 7 onwards UI Automation is deprecated. And apple have brought in UI testing. With the limited tutorials available in internet I could understand that UI testing can be implemented only on an Xcode project. It cannot be run in an pp file individually. Please do correct me if my understanding is wrong. And guide me on how to do it.
Thanks in advance :-)
Don't know exactly how you can write UI testing for APP/IPA files.
But in the sense of code needed, I would rather say no. As the UI testing uses view hierarchy to find the UI Elements and perform actions, e.g. app.buttons["Hi"].tap().

Creating an iOS library or framework using libgdx (roboVM)

Is it possible to create an iOS library or framework using libgdx (RoboVM) that can be imported into Xcode?
Background:
One of my colleagues has created a 3D visualisation app as a libgdx project for android and windows desktop. It can be compiled to run on iOS using RoboVM. However, I would like to wrap extra native user interface elements around it using Xcode. I know its possible to build the user interface programmatically via RoboVM but I would be keen to investigate if its possible to bring the existing work into Xcode. I don't need to edit the 3D visualisation component but add extra GUI elements around the 3D Vis window. I thought compiling the libgdx (RoboVM) code to a framework or library might be a solution that could be imported?!
Yes you can do it.
All you need to create a method, say initRoboVM(), This will be called by your code when you want to initialize libgdx. You'll need to pass the app path in, which you can hardcode when you're testing.
initRoboVM() will need some modifications, namely it should not call your Java app's main method, well, at least, that's what well behaving libraries should not do IMO. It should also not call rvmShutdown.
You can get further information from here
Thanks :)
I asked the RoboVM team directly. Their answer: It's not a native function, but it certainly can be done.
The complete message...
Hi,
Sorry for the late reply. This use case is not something we're going
to do now. It is possible though if you're prepared to do some
patching of RoboVM. Search the RoboVM Google Group and you should find
others who have managed to get this working.
We get this request every know and then so we will add support for
this eventually.
Regards, Niklas

Show unity 3D in xcode project

I have a question. Is it possible to load unity project from web, and show it in Xcode project? In some non-fullscreen view? Also, unity must handle touch events. Any ideas, suggestions, links or anything else?
Thanks for advice.
P.S. Sorry for my english.
P.P.S. Main project created in Xcode, without unity.
load unity project from web
What do you mean by that? If you mean a compiled unity webplayer application, forget it.
If you mean a standard non compiled Unity project, note that with the iOS plugin you can compile for mobile Apple hardware. This used to cost a lot of money but now they're giving it out for free (included in Unity free).
Also, unity must handle touch events.
The standard Input Unity class handles touch events with methods such as GetTouch() and variables like touchCount or touches.
Unity is a very big and complex package: integrating it into an existing project may be overwhelmingly difficult. I really don't think there are natives way to do so.
Rather, I'd advise you to port your current XCode project into Unity (which sounds a really strange thing to do if you ask me).
Unity and XCode are 2 completely different tools: the former is useful for Cocoa classes and iOS IDE while the latter is for managing 3d game assets in a real-time interactive environment. I don't see how you can possibly integrate the two things.
Manage your project in a single IDE, it will make things a lot simpler.

Using Protocol buffers in PhoneGap - iOS

I have used the c++ google protobuf classes in iOS using the native app approach, i.e. using Xcode, objective c, cocoa etc.
Now, I want to migrate to hybrid apps and I have explored the options on web, and according to my requirements i'm down to PhoneGap and Titanium. That will require me to use JavaScirpt, HTML5 (JavaScript only in Titanium as per my understanding) jQuery etc.
My question is, HOW am i supposed to access the my c++ protobuf classes from javascript. (i have no expertise in JavaScript).
I am also open to opinions on which hybrid-app framework to use.
Lords of web-dev....guide me.
With PhoneGap, if there is a phone feature that the PhoneGap APIs do not currently expose, or if you have some specialised native algorithm / function that you wish to access, then you need to write a plugin.
PhoneGap plugins provide a standardised mechanism for packing native code and accessing its functionality via JavaScript. See the PhoneGap Plugin Development Guide.
Personally I think PhoneGap is the best hybrid framework, it had been around for a while, is well documented, and has a healthy community.
This is an old question, but you can always use the 100% JavaScript implementation of ProtoBuf in your JavaScript code. It works well, and you can even precompile the .proto file if you want.
In Cordova it would be better to create a plug-in, but if you don't have time or skill to do that, the linked code works well.

Resources