(iOS) Way of viewing log messages directly on an iOS device? - ios

As nice as debuggers have gotten these days, sometimes the best way of finding out what is going on in an app is still ye olde NSLog. Doing this is easy when you're tethered to your computer; Xcode helpfully pops up the Log Viewer panel and there you go. Not so easy to do when you're away from your desk, as you sometimes have to be when testing an app (for example, when you are testing CoreLocation functionality). Sure you can pop open Xcode and check the Console section of the Device Organizer as soon as you get back from a testing run, but then you have to wait, and by the time you can get back to view the logs you forgot what was going wrong with your app; also odds are that by the time you are able to do this, the log messages you are looking for have scrolled off into oblivion.
Is there any way of checking the console logs on the device itself? I'm guessing the answer is "no, unless you jailbreak" (IIRC there are at least one or two terminal apps in jailbreak-land that I could use to do this sort of thing). Unfortunately jailbreaking is not an option for me.
Alternatively, is there some sort of Objective-C framework or library or whatnot that handles log collection and on-device displaying? Ideally this would come in the form of a drop-in replacement for NSLog, whereby I could simply do a search-and-replace and change all occurrences of NSLog to SomeFancyPantsLoggingTool or whatever and be done with it.
A good example of the kind of functionality I am looking for can be found in the podcast client Downcast. If you tap the "More" tab, then tap on the version number string at the bottom of the screen, a new view slides up that contains a scrollable view of accumulated log messages. It even has an easy way of mailing said logs to a support e-mail address.

Take a look at LibComponentLogging which you can configure to output logging at different levels and to different destinations.

There is a file for the SysLog. You can simply open it and read from it. The file is at /var/log/syslog. If the file does not exist there are instructions on how to set it up here.

Related

SwiftUI / iOS 14: How to restore last active document (state?) with document-based (DocumentGroup) app

I am working with Xcode's provided SwiftUI multi-platform, document-based app template.
Everything so far has been "smooth sailing", if you will, however I have no been able to figure out something I though was "built in":
If, for some OS management reason the app gets "killed" (or if intentionally, by stopping it in Xcode), when relaunched, the app "forgets" the document the user was working on, and starts up showing the document browser instead.
I looked on the documentation, and found an article titled "Restoring your app's state with SwiftUI" - this article offers sample code for a non-document-based app, but for the life of me I cannot even begin to understand what it is I am supposed to do to adapt it to a doc-based (DocumentGroup) scenario.
I "understand" the concept of SceneStorage, I was even able to persist some random text declared as a SceneStorage property of the example ContentView, but I cannot understand how am I supposed to use this to, when relaunching the app, have the last open document, well, back open.
I sort of tried to do this at the #main code declaration, but could not make it work.
Also, Google has NOT been my friend in this case - have not been able to find a single example of this particular scenario anywhere.
I know I might pass as a "noob" (I am...) and that this is fairly new, so I should expect lack of "stuff" around, and that this should not be so hard, so please forgive my "noob-iness" in advance.
If anyone has any idea about how to achieve this, or can point me to a WORKING sample with a document-based/DocumentGroup app, I will be eternally grateful.

Is there any way or tool to check whether a particular iOS app is checking Jailbreak detection?

I'm just learning the Iphone security out of curiosity. This is completely a beginner question.
I've seen the posts on Stack Overflow,
How do I detect that an iOS app is running on a jailbroken phone?
How to detect that the app is running on a jailbroken device?
Those answers are providing the information on "if the app is running on a jail broken device or not". But I need to check "whether the app is running a JailBreak detection or not." ( Not in the programmer point view, but more of a Pentester point of view ). Are there any tools, methods ?
I'd achieve this by downloading Flex 2. With this tool you can view all of the variables, functions and procedures that are in an app.
Go to the patches tab, press the '+' symbol and locate the app to create a patch for. Then process the app by tapping it - don't worry about adding patch name.
Next, when you're inside the processed app you need to press "Add units". This will allow you to add overrides so that you can change what functions return and such.
Anyway, from here, you need to select a class to look inside. The jailbreak detection functions and variables are always stored in the executable. Tap the app name again at the top of all the classes under the 'executable' tab. Then just search.
Just search for "jailbreak" or "jailbroken" and if the app is running checks then it will return functions and vars related to this. I am yet to see an app that runs this check with a different function name that does not include "jailbreak" or "jailbroken".
If you'd like, I can show you how to override this detection.
I suggest you try the app "highway rider", because that has detection and you can easily see, and override it nice and easy and get the startup warning to go away if you want!

How can I use an online code compiler's output through in a code compiler app?

I want to make an app which compiles Swift code, so how can I use a website named www.swiftstub.com or any similar website to retrieve the output of the code? I want my app to have a simple UITextView in which the user can type the code. If a UITextView cannot be used, what can be used?
I want my app to send the code typed to this website, and then retrieve the output back and display it. How can this be done? Thanks!
Make an app that sends text to a server.
Have the server compile this code, run it, and capture the output.
Send this output back to the app.
Have the app display the output.
This is an extreme oversimplification, there are lots of things to consider, but these are kind of the big sections of whats there to to. You need to understand very well on the app side: UI and networking, and on the server side: triggering a compilation of text, capturing that output (command line, maybe Swift or Python can help you here) and HTTP(S) responses and requests (or sockets, even harder).
This does not sound like an easy task, so you are very courageous.
Build all components locally:
App:
- write an app with a textView and a button, and on the tap of that button, save the output to a textile. This is to avoid any networking complications at this point, later, instead of saving, you would send this to a server.
Server: (just build the things on your computer)
- write some script/program that can read in that textfile that was saved.
- Then you need to compile this code (lookup 'xcrun' on google) and capture the output. Save this output to a textile. Have your app load this file and display it.
The important thing to consider is the real server machine you will run this code on later: it has to be a machine that can compile, and execute Swift code. Currently, this means it has to be an OS X machine. This is hard to find, as most servers run linux, and there is no Linux Swift compiler yet.
Getting this to work would be a proof of concept: you can capture text from the app, you can grab this text and compile it, you can capture the output of the compilation, and you can have the app read that output and display it.
Once you've got this working, you would need to find a server that can do the compilation part, and run what you build to do that. Then you would need to write some code in your app that sends an HTTP request to your server containing this text, to which your server would respond with the output of that compilation.
As I said, this is a big undertaking, with lots of difficult parts and unexpected surprises, so don't expect this to be done in a couple of weeks, it will most likely be more like over six months.
Try to find someone who has experience on programming and setting up a server, that will really help you a lot.

Send file to print in the background from ruby on rails app

I'm looking to make an app be able to print out a stick on name tag based on some fields that the user has filled out. The catch is that I don't want the user to have to interact with any sort of system print dialog, I just want it to go straight to the printer and print out after they submit.
The other catch here is that this will most likely be run on an iPad, so I will need to try to send this print job over the air either on wifi, somehow to a computer that is usb connected to the printer or over airprint if I can find one that is small enough and supports the right paper.
I've seen some solutions here and there that require the app to run on windows, or to be connected to the printer some how.
I'm not sure if this feat is possible with this setup, but the most important part is being able to print in the background, if the iPad is going to hinder that, there is a case we can make to our client for getting a small, cheap, windows 8 touch tablet instead of an iPad since I know it has a few more capabilities in this area as it seems through my research.
It doesn't matter what version of ruby or rails it's in and I don't care if it's 2 steps or 200, if the user experience is there, I can make a case for the increased work load needed to make something work.
I'm not a very experienced rails developer, but this project is my first big project that is simple enough that I can tackle it. If more information about how their name tag info is being collected I can shed some light on that as well but I don't think it matters. Whatever I'm printing I need the experience to be the above.
Have a look here: http://support.vendhq.com/hc/en-us/articles/201378390-Enable-kiosk-silent-printing-for-Google-Chrome-on-Windows-Video- under 2) Kiosk printing for Google Chrome
Basically this is using Chrome's Kiosk printing mode. So you would have to get a PC for it to work.
The "print dialog" will pop up shortly but then automatically disappear the the document will print.

no idea where to start: 'calculator-like' rails app that displays a keypad user can click to type

I need my webapp to display a 'keypad' on the screen that makes special-purpose data entry very easy... can't be flash since needs to work with ipad (and also work from regular pc/browser/ mouse).
The simplest variation would be a 'calculator' app where they press number keys and functioin keys and the app takes the input and displays results.
we very specifically need to provide data input from our webapp screen by click/touch 'keys' -- not from the PC keyboard (or soft keyboard on ipad)
I have no idea where to start... any ideas would be appreciated! For example is there some nifty ajax and/or jquery thingy that lets you build an input keypad?
https://github.com/davidnorth/JsReckoner you can take this repo for your base and modify it. Good luck

Resources