Collect iOS application logs automatically through script - ios

I have been going crazy over this, is there a way to collect iOS application logs through script? I am working on an iOS application and have written some UI Tests now in order to gather logs i had to manually take it, is there a way some utility may be in form of script which i can fire and download the logs on my mac. Ofcourse my devices under test are connected to my mac machine. I have been going over cfgutil, apple script but so far no luck. Anybody with knowledge and care to help. Please do so!! Thanks!!

no. you can't, mainly because the output of debug in xcode is handled by xcode it self

Related

Run any app in iOS 10+ from command line without jailbreaking

Is there a way to run any app in iOS 10+ from command line/Mac without jailbreaking?
Re-signing and none of the existing tools seem to work (ios-deploy, Instruments) nor have I been able to find a way via iTunes or other programs.
Yes it is possible for any App you have the source code for.
No it is not possible for any App you acquired from the App store or direct download.
Not quite sure I fully understand your emphasis on any app, but here is what I understand:
1) If you mean you want to run any app from the app store that can currently be downloaded, and you have a .ipa file, you can definitely install it manually to another device using this method (iTunes drag and drop)
2) If, however, you're trying to run an .ipa on a Simulator, that's not possible, as described by this answer.
3) Lastly, if you have source, which I'm confused about since you mention re-signing, then you can easily build that source into an executable for either Simulator or device using either Xcode, or since you asked about command line, you could also use xcodebuild, info found here
I hope one of these 3 options is what you're looking for, as it's hard to tell from the wording of the question. If it's not, expanding on exactly what use case you're trying to resolve would be very helpful.
From the comments in #BHendricks answer, it seems you want to use the command line on your computer to start apps that are installed on an iOS 10+ device.
This is not possible without jailbreaking the phone!
On a jailbroken phone it might be possible to write something that connects over ssh and starts apps, but on vanilla iOS this is disabled for security. You could search for an app that you can send commands, but I highly doubt iOS apps have access to system features like starting other apps, as this is also a large security risk.
If you have the ipa, you can install the app via iTunes. This is what we used to ask QAs to test apps on devices and it works fine. Please refer to this [SO] for detail Install IPA with iTunes 12.
Use Cydia Impactor (cydiaimpactor.com) to sign the app. 99% chance it will work

How do you access the all of the NSLog statements?

I have an application which is producing an error very intermittently, I am trying to run it down with an NSLog statement in swift. However, after I have noticed the bug has occured, when I hook up my iPhone to review the logs in the Devices window. I only see about 5 minutes worth of statements from various applications. Is there a way to get the history past what automatically comes up? Is there a way to get your applications NSLog statements only?
I haven't tried it from Swift, but we sometimes use NSLogger from Obj-C. It will log to a local Mac application instead of the console on the device. Alternatively, we sometimes log to a file and then transfer the file via email.
You can take a look at Bugfender, it's a product we have built to solve this problem. We had the same problem, especially when delivering beta apps to our customers, so we decided to make a product to solve this problem.
With Bugfender you will be able to get the device logs without any need to connect the device to your computer.
It's easy to integrate and you can choose which devices you want to get the logs from. Our service works offline and online, we have spent a lot of time to make it reliable and easy to use.

ios app-on-device debugging events

Newbie here, so apologies if this is stupid question:
Are there any applications or solutions out there that would allow you access to debugging events on an app installed on your iphone? To be clear, this isn't an app I've developed, it's just on my iphone and is used as part of another solution which we are developing. Curious if there's a way to just watch the events on an app to help with debugging process.
Thanks.
If you make an app, and build it with a development release, and development signing, you can select to build+run it on a device. Then, you can use the Xcode debugger to see your logs / errors etc.
Steps:
Plug in iPhone
Start Xcode
Hit Build + run
Watch debugger
Logs are either made by the OS for certain things (NSinconsistency, bad constraints, race conditions in view presentation) or by you with NSLog.
Or did you mean when the app is not tethered to your computer? There are other tools for that - including just plugging the phone back in and downloading the logs off the device.

Using Instruments to test an iOS app without having source code to the application

I would like to use UIAutomation via Instruments in Xcode to test an app on my iOS device. Is it possible to do so without having to build the source code? The reason for this is that our team will have testers who will be writing automation scripts to test the apps on our devices, but we don't want them to all go through syncing to latest builds and compiling it through Xcode. Does anyone know if this is possible through UIAutomation or possibly through a 3rd party application?
Thanks.
You could make UIAutomation tests without the source code, but you will not see your symbols and you cant see where in your code your app is hanging.
You still can see if there is a routine that is taking to long to run, but you wont e able to see witch one or the call stack
to make your tests without the source code just open the automator and bind your test with an application installed on the device

Xcode - How to move app out of sandbox with run script?

Basically from what I understand is that if my app wants to use serial communication via the dock connector (pins 12 / 13) the app has to live outside the app sandbox folder. Now I don't want to have to ssh into my phone and copy theAppFolder.app to /Applications/ everytime I click Run in Xcode (that would just be silly).
Now while doing some research I came across this blog post. Down in the comments, someone gives the idea of what I am talking about in this question.
Now is his solution the best way to do what I am thinking of doing, or is there a more elegant solution?
A bit late, but I use Xcode's build command with a post-build script to get my app on my jailbroken iOS device and also start it using a tool from Cydia (it will actually run the app from the /Applications directory). Check out my answer here for more info. The thing still missing is the ability to debug, but I've gotten used to using NSLog and tailing the syslog.

Resources