How to develop iOS simulator plugins - ios

With the rise of different apps, which hijack the iOS simulator (such as flawless or now sherlock) I'm curious how this is done.
As far as I've found there were options based on SIMBL but I don't think the above use it. Further more there is Injection (https://github.com/johnno1962/injectionforxcode) which uses XPC's to inject code.
I would guess there are different ways (e.g. how is the UI change done? both either the flawless layer on top of it, or the variable change in sherlock) so it would be great if someone here would point me in the right direction.

I havent used the plugins BUT:
sherlock loads code in the app being run BY the simulator from what I read. (https://www.hackingwithswift.com/articles/131/sherlock-turbocharges-your-ios-simulator)
flawless but afaics on the website all it does is overlay a UIWindow ontop of the simulator window. Even a separate app could do this.
(https://flawlessapp.io/)
SIMBL could do both id I'd say...
but you can do a lot by attaching LLDB too! really powerful. (a good example is https://github.com/facebook/chisel)
xcode's code injection is basically the same (roughly ;)
=> there is still no public / or private api for the simulator AFAIK
=> targeting apps inside simulator seems easier to me
(there are other ways by manipulating defaults or by playing around with simctl process)

Related

List all device information with Flutter on iOs

I am facing the project which should be as many other "boost cleaners". I'd appreciate any advise on this theme. As far as my research goes, I see, that it is quite more difficult to do in iOS, rather then Android. I don't hope for any good lib out there, and should probably do platform channels.
In general I need right now somehow get all device info - memory, battery, installed apps, cache, etc.
AS I've said, I had done a bit of research, and see the problem as stated.
If you can use Libraries for it i don't think there is any library which can support all info so you will have to use multiple libraries.
Just make sure library should support all the platform you want to build you apps on.
https://pub.dev/packages/system_info_plus.
https://pub.dev/packages/battery_info.
https://pub.dev/packages/device_info_plus.
https://pub.dev/packages/installed_apps (Only Android)

Fixing low FPS in Swift Playground

My SpriteKit playground book averaged 15 FPS on my MacBook Pro.
Do playgrounds run slower than iOS device simulations? If I run the same playground book on my iPad Pro, will the FPS limitation be similar? Will other apps opened on my computer limit the speed of playgrounds?
EDIT:
Moving code such as subclasses and extensions to auxiliary code in the "Sources" folder of the playground book allow the simulation to run quicker because the code only compiles once.
On the Mac, Xcode's "Playgrounds" are super useful for quick experiments but, due to their nature, terribly slow for "real" tasks.
If your code is more than a few pages long, and/or involves working with the UI, as you do with SpriteKit, the Playground may become really slow, sometimes even unresponsive.
"Playgrounds" are part of Xcode and run on top of the iOS simulator - that's how they display graphics and UI in the "Assitant Editor". The iOS simulator is not really known to be fast either.
On the other hand, "Swift Playgrounds" on iOS is a completely different app, even if it shares a lot with its Mac cousin.
Most importantly, it runs in iOS on the real device, with the real hardware processing, not emulation, which makes it ideal to use for SpriteKit, as Apple themselves often shows in their demos.
I would therefore say that your code should indeed run faster/better/properly on the iPad version.
Even if of course, I can't really know, since I don't know your code - you will probably be the one telling us later if using the iPad version made a difference.

porting iOS project for mac platform

I have been searching around for a method to port an iOS xcode built project to OSX xcode project. Unfortunately, I have found that because there is no UIKit or storyboard for OSX xcode (just individual .xib's). Is there a way around this?
If you're a registered Apple developer there's a new video up that goes through some of the basics and the design patterns you should be aware of, just named "Bringing Your iOS Apps To OS X".
The UI paradigm of any non-trivial iOS applications is entirely different to that of one for MacOSX.
Necessarily, you will need to redesign the View layer of the application. However, the Model layer ought to cleanly port over and at least some of your controller classes might be reusable, although MacOSX doesn't have anything equivalent to a UIViewContoller.
Besides this, many of the frameworks your app might be using are either available for both iOS and MacOSX (usually in cut-down form on the former), or a similar.
If your logic and UI are well separated, you have a chance at some good re-use, but at a minimum you will need to rebuild the UI layers of your app; it's going to take time.
If you don't have the time to invest, and if you are willing to try something experimental, there are a couple 3rd party frameworks available that attempt to bridge the UIKit AppKit gap.
You can probably consider many of these as risky 'shots in the dark', but they are worth a look. Keep in mind the long term support ramifications as well.
Chameleon
UMEKit

Add custom settings bundle to jailbroken iOS settings.app?

I was looking into making a custom toggle switch option in the iOS settings.app menu to turn a home cooked function on and off. I was wondering if it's possible to do such a thing. If so, how?
Yes, this is possible, but it works a little differently for jailbreak apps, installed in /Applications, than it does for normal App Store apps.
Take a look at this documentation here. I haven't used it in a while, so if there are things that are out of date, post a comment here, and I'll try to update my answer with code, etc., from one of my working jailbreak apps that does this.
Note that if you want the Settings switch to execute your custom code, rather than just storing a preference value, you'll need to use the PreferenceBundle Approach described in the link above.
You'll also need to make sure the phone has PreferenceLoader, by Dustin Howett, installed on it, for this to work. If you're distributing your app to users (via Cydia, or something like that), you can make sure that PreferenceLoader is automatically installed along with your app. To do this, add this line to your app's DEBIAN/control file:
Depends: preferenceloader
PreferenceLoader is free, has been around for a while, and seems pretty stable, so it's not a bad dependency to have at all. Most jailbreak users will likely already have it.

Using Shared Object File in iOS (.so file)

I have been given a Shared Object file (.so) and the functions inside of it, but I don't have a clue as to how to use it, or alter it for use in an iOS application. Could someone point me in the right direction?
I know the .so came from an Android application, but I was told I could get it to work in an iOS application as well.
Actually and technically, yes, you can, but not in a way you would ever think.
If it came from Android, it is probably compiled for ARM. So it should be binary-compatible with the ARM CPU in iOS devices. However, iOS doesn't use the usual format of shared objects (that is, the ELF format), but iOS' and OS X's own Mach-O format.
This means that you cannot directly link against this shared object file nor are you able pass it directly to dlopen() and dlsym(). You have to get into serious hacking (something that you probably don't know). This involves loading and relocating the file properly.
An example of this can be found in iOS jailbreak developer and hacker, Comex's GitHub repository Frash, a Flash player for jailbroken iOS devices. Comex essentially wrote an ELF loader module (dubbed "food") for iOS and used it to make Android's libflashplayer.so work on iOS. Pretty neat, huh?
Also note that this is not going to be possible for AppStore apps as it needs dynamic loading and various alterations in the OS.
while technically possible (see h2co3's answer) for anything practical the answer is no
so files arent in the correct binary format
even if they were, dynamic loading is not allowed by appstore

Resources