Run app "as a service" on iOS / Cydia - ios

I'm currently trying to create a little app that should run in background. It should start with the system or springboard and run until the device shut's down. I searched for tutorials out there but doesn't found anything really useful. It would be great if someone would help me out.
Best regards
EDIT: I'm sure that it isn't possible in an app designed for the appstore, but i'm looking for a variant that work's on jailbroken devices.

ColinE's answer is wrong. SuperDev's is correct. You certainly can create services on iOS, just as on OS X.
As another reference, the best tutorial I've found on the subject is Chris Alvares' blog post on creating an iOS Launch Daemon. (Launch Daemon is the proper iOS terminology for what you're describing)
You may find additional useful information within the Apple Docs for Launch Daemons, or searching for OS X information, instead of just for iOS, where it requires jailbreaking (and therefore is less widely used).
Cydia has lots of apps that are launch daemons, or contain launch daemons (possibly in addition to a UI application).

Have you read about launch daemons? You could use one of those. An example is untrackerd by rpetrich, an awesome cydia developer.

This is not possible, you cannot create 'service' type apps:
iOS: Keep an app running like a service
This is by design. Apple limits the the capabilities of your apps in order to ensure a good user experience. If everyone could create background services, it would soon slow down the user's phones - like a Windows PC!

Have you tried reading about Mobile Substrate? It let's you build extensions for the springboard. That way you could run the app in the background.

Related

Block app install from AppStore and app delete using Swift

I am aware that we can block safari content using swift code. I am interested in finding out if we can restrict install of certain apps from AppStore using similar approach ?
Also, is it possible if we can restrict a user from deleting the app from device (not from phone settings but from code) ? Even if Apple does not allow that to publish such app, I am looking for a solution as a part of research.
There are two things you mentioned.
First, can restrict install of certain apps from AppStore
Using Swift code I feel there are no Public API provided by Apple for the developer till now but there is a similar way that is called Device Enrollment Program.
The Device Enrollment Program (DEP) is part of the Apple Deployment
Programs (ADP), which help businesses and educational institutions
easily deploy and configure iOS and OS X devices. DEP provides a fast,
streamlined way to deploy institutionally owned iPad and iPhone
devices and Mac computers that are purchased directly from Apple or
participating Apple Authorized Resellers or carriers.
For more visit this developer guide.
Second: restrict a user from deleting the app from device
Same response for that, till now no Developer API, but lets say if we see this as a part of research and we develop some POC still, it does not make sense for me at all (It's my device and I install the app for making my life easy and better if I don't want to use it anymore, I need an option to delete it) and I don't think so this will be possible in future as well because the USP for iOS device is user experience and we can't make this like that.
I also want to hear something from others and if possible give the use case why you are looking a solution like that.
I hope this will help.

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

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.
I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.
This will certainly not be released on the App Store as Apple wouldn't allow it.
I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.
What I've already looked through:
how to determine which apps are background and which app is foreground on iOS by application id
How to know about app launched and details jailbreak iOS 7
Is there a private API to be able to detect what is current foreground app on iOS?
How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices
which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like
Can you find individual app usage duration using SpringBoard services framework or other private framework?
Find out active application or if on Springboard
Programmatically detect which iOS application is visible to user
However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.
Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?
Ideas:
inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:
Detect which app is currently running on iOS using sysctl,
Return a list of running background apps/processes in iOS
How to get Names of Background Running Apps
Find Background running apps in iphone
inspecting the phones traffic somehow?
not sure if there is some kernel stuff that I could do
Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.
Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.
For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.
sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

Launching an iOS app on device reboot

I want to write an iOS sample application which can launch itself whenever device is rebooted. Please share your thoughts and any pointers will be really helpful.
Setting VOIP in background modes seems to be one option.
I am NOT looking for a Jail break solution.
There is a way if you have access to MDM tools or the Apple Configurator, and are able to control the device and its' profile. For example, if you are the curator at a museum or you or a teacher and hand out iPads to students, you'll most certainly have this level of control; and since you're writing a sample application, I suppose this level of control is possible as well.
There is a feature known as Single App Mode (see page 17) that locks a device into a single app. According to the documentation, if the device is powered down, the specified app will launch at boot. (I don't have the setup to confirm this.)
Note that Single App Mode is not the same as guided access mode, though people do tend to get them confused.
So should you have access to the right tools your original intent may be possible.
There is really not much you can do to achieve such functionality. The most you can do is to provide background fetching to prepare your app for when user launches it explicitly.
I have never seen a single app that could launch itself for no reason.
Hope this can be useful.
Can't be done unless the device is jailbroken, and I can't help you with that.
To my knowledge, this is not possible. Your app does not have access to this level of system information.
What you could do is periodically send push-notifications with a payload that temporary allows you to access app functionality.

Can an iPad be used as a development machine to create iPad applications?

My wife has a iPad and I was wondering if I could use it to develop iPad applications? I am assuming the answer is no.
Apple's development guidelines ban apps of this type from the store, so no you unfortunately cannot use the iPad to make iPad software (You can test the programs you write on your Mac on the iPad though). You need a Mac and the XCode IDE to actually create iPad / iPhone applications. You can learn more about this at http://developer.apple.com/
EDIT:
While it isn't possible to directly write code that runs on the iPad, you certainly can write code on the device itself. There is an app available in the app store called CodeToGo that lets you author programs in quite a few different languages. When you want to run your program, the code is actually uploaded to a server, executed there, and the results of that run are returned to you. This, or a similar program, is the closest you will currently get to writing code on the iPad (or iPhone).
Here is an article that talks about / reviews code editing programs for iOS.
Take a look at Codify. Not the whole 'write anything, run anywhere' experience, but a step in that direction.
Yes, it can. If you are a Lua developer, I recommend Codea (formerly known as Codify). For Python developers, I recommend Pythonista. Both apps allow you to write and test code in-app, and they even include support for graphics such as games. There is a GitHub project that actually lets you compile Codea projects into full-blown AppStore apps, the Codea Runtime. The app Touchline is one such application.
Unfortunately, there is not currently an official way to compile Pythonista apps and sell them on the AppStore. The developer has, however, made a utility that allows you to install webclip based icons on the homescreen that will run a Pythonista script. Also, there are plans to incorporate an export to Xcode mechanism in a future update of the app.
Check this out: http://www.slideshare.net/carlbrown/developing-ios-apps-on-your-ipad-with-xcab
I haven't tried it myself, but apparently he's created a way to code on the iPad, upload the code, download the compiled project, install it, and run it, all from the iPad. He says you cant do gui stuff, but at least you can do the logic on the run.
If you make for instance ruby on rails applications and let them have a mobile theme they can run in the safari browser of the ipad. The benefit of this is that you don't need Apple to review your code. The cons are that you can't use the appstore to sell and distribute your app.
But it can look and feel like a native ipad app.
I'm exploring this business model right now and would like to hear if others have done this.
Your app will run on an external server like Heroku, be archived on github.
Try CppCode - C/C++ IDE & Compiler that works on iPad/iPhone. http://cppcode.info

Resources