Is there an equivalent of the Reachability class for Actionscript 3? - ios

In iOS dev it is common practice to use the Reachability class to check that you can hit a web service or other network path. I need to do something similar to check that an asset path that is being passed into a Flash SWF exists.
I don't want to run a test to load a transparent image cause this will take time to return a fault or result.
Any ideas?

Have a look at ServiceMonitor.
http://livedocs.adobe.com/livecycle/8.2/programLC/common/langref/air/net/ServiceMonitor.html
http://code.google.com/p/poliwar/source/browse/trunk/projeto/servidor/lib/air2b2/?r=66

Related

How to create custom AR button

Does someone have any examples how to generate AR URL?
Reading Web SDK documentation, seems that there is no functionality to do that.
Found https://github.com/Roomle/roomle-button but not sure that`s still way to go since it has not been updated for 2 years.
If you are using the Roomle SDK you can use saveCurrentConfiguration to get the configuration id (hash) of the current configuration. Not sure what you used at the moment to obtain a configuration id but you need to call this in order to save it on the Roomle server and open it in another place.
Also make sure to set the configuratorId URL param when linking to the AR site.

How to stop an instance of GCDWebUploader - Objective-c iOS

In my app I have successfully started an instance of GCDWebUploader and I can upload files into my App's documents directory.
What I would like is to give the users the ability to stop the web sever whenever a button is pressed.
I've tried to set the instance to nil but this has no effect. Does there is a way to do this ? I've looked into the GCDWebUploader's header files but with no success !
Any help is greatly appreciated !
Have a nice day
GCDWebUploader subclasses GCDWebServer, so be sure to also look for methods in the super class. The one you would likely want is -stop.

XCUIApplication replacements for UIATarget captureScreenWithName()

We are trying to migrate from UIAutomation to XCUITests and did use the captureScreenWithName() API to programmatically generate screen shots.
What is the replacement in the XCUITests ?
(I know that automatically screenshots are taken in case of error, but we have a special test which runs forever in a loop and evaluates QA click,tap commands via network similar to the appium-xcuitest-driver https://github.com/appium/appium-xcuitest-driver)
Do I need to rip out private headers (XCAXClient_iOS.h) like the appium guys did in order to get a screenshot API?
Edit
I used the actual code line for the accepted solution from
https://github.com/fastlane/fastlane/blob/master/snapshot/lib/assets/SnapshotHelper.swift and its just this for IOS
XCUIDevice.sharedDevice().orientation = .Unknown
or in objC
[XCUIDevice sharedDevice].orientation =UIInterfaceOrientationUnknown;
I use a process on the host to lookup in the "Logs/Test/Attachments" directory all Screenshot_*.png files before the call , and find the new shot then after the call as the new file added in this directory.
Gestures (taps, swipes, scrolls...) cause screenshots, and screenshots are also often taken while locating elements or during assessing expectations.
Fastlane's snapshot tool uses a rotation to an unknown orientation to trigger a screenshot event (which has no effect on the app): https://github.com/fastlane/fastlane/tree/master/snapshot - you can use this if you want to be in control of some screenshots.

Get path to iOS application based on name or bundle identifier

Is there an easier way to get the path to an iOS application, than searching /var/mobile/Applications?
I know both the name and the bundle identifier, however the path is not consistent on different iOS devices.
This is for use in a jailbreak tweak, so I can use PrivateFrameworks and other code not allowed by Apple.
If you're running code that executes in Springboard, this should be fairly simple. Get SBApplicationController's sharedInstance, then get the SBApplication you're looking for with the applicationWithDisplayIdentifier: method (or using whatever method you choose). The SBApplication class contains properties for path, containerPath, and bundle (among many others), one of which should be what you're looking for. I haven't tried this myself, so I can't guarantee it'll work, but based on a quick glance at the Springboard header files (you can take a look here, or dump the header files yourself), it should work.
On the other hand, if you're not running from Springboard (ie. if you're making an actual App Store-style application), then you may be out of luck. You could look into inter-process communication with Springboard and see if something can be done there, but it'd probably be more trouble than it's worth.
If running in an app, you can define:
extern NSString* SBSCopyBundlePathForDisplayIdentifier(NSString* bundleId);
and link to the SpringboardServices framework.
Or you can use the library AppList and then it's:
ALApplicationList *al = [ALApplicationList sharedApplicationList];
NSString *appPath = [al valueForKey:#"path" forDisplayIdentifier:bundleID];
In this case it's doing what Andrew R. mentions in his answer for you. (I assume the same requirements are necessary, i.e. must be running from Springboard.)
Update: This no longer seems to be working on iOS 11.

Why is WSCript object not known to my script that's controlled by a custom IScriptControl?

I am using someone else's library that provides its own scripting host instance, it appears.
This lib provides me with functions to define the type of scripting language such as "jscript" and "vbscript", and I can supply it with script code and have that executed, with passing arguments in and back. So, basically, it works.
However, when I try to access the "WScript" object, I get an exception saying that this keyword is undefined.
The developer, not knowing much about this either (he only made this lib for me because I do not want to deal with Windows SDKs right now), told me that he is using "IScriptControl" for this.
Oh, and the lib also provides flags to allow "only safe subset" and "allow UI", which I set to false and true, respectively.
Does that ring a bell with anyone? Do a user of IScriptControl have to take extra steps in order to make a WScript object available? Or, can he use IScriptControl in a way that this is supplied automatically, just as when running the same script from wscript.exe?
Basically, all I need is the WScript.CreateObject function in order to access another app's API via COM.
I don't know why WScript is not known, but I suspect it is because the script host doesn't provide it. Maybe only wscript.exe does this.
If you are using Javascript, to create an object you can use new ActiveXObject(). If you are using VBScript, you can just use CreateObject.
See this article for some background.

Resources