So I know it's possible on a jailbroken iOS device to inject a dylib into a running process and interpose/hook system functions. I'm wondering if it's possible on a non-jailbroken device to interpose system functions at either link or run time, assuming I'm the one building the app? Maybe the equivalent on linux of using dlfcn and LD_PRELOAD?
An example: I want to take an app I've built that uses various Cocoa/Core Foundation abstractions for filesystem access and wrap the underlying open/read/write/close calls. I know about swizzling in Objective-C, but I'm looking for something at the libc level so I capture everything. This is for something test/debug related so it doesn't need to be App Store friendly. Thanks!
No, it's not possible (to my knowledge) on non-jailbroken iOS device. All traditional forms of dynamic loading (interposing, dlopen/dlsym, etc.) have been removed.
Since you mention that your needs are related to test/debug, you might want to try to make use of DTrace if your problem exists on simulator. You can use DTrace on simulator, but not on real iOS device.
Related
Does Apple allow the usage of sysctl.h within iOS applications?
PS: App Scanner, a third party tool that checks code for possible private-API usage seems to think it's okay.
Note:
There is one more question like this : How can I know if I'm using private frameworks?
With the usual disclaimer that nobody can tell you what a reviewer will do, I can say for sure that there are apps in the store that use sysctl functions.
(Minor point: Simply including a header isn't a problem since symbols there shouldn't be visible in your app unless they're used...it's the things you use that might get flagged rather than what's included.)
I am currently deploying to IOS, but plan to deploy to Android and other platforms down the road.
I need to know whether the system volume is turned off so that I can show a relevant icon on the screen.
Within Unity, is there a way to determine whether the system volume is muted?
I am not aware of Unity functionality that would allow you to do that (because AudioSource is tied to object, not to "application" itself) - but maybe there is some magical utility that allows you to do that. The problem is that even checking in pure iOS is not as easy as checking one property, since system itself does not indicate it, or at least it does not work for later version (iOS7, 8 - and possibly 9)
Anyway, I personally think that you have to resort to system specific implementation for both Android and iOS (and whatever you want to support). For iOS, there are great posts that go to great detail, I suggest you check them:
https://hoishing.wordpress.com/2014/05/08/mute-checking-in-ios7/
Detecting Silent Switch in iOS 7 issue
Hope it helps a little, though I guess I did not bring any good news :)
Is it possible to manage the memory of a process alien to itself in iOS?
By this I mean to be able to read and write bytes on iOS applications, something like ReadProcessMemory and WriteProcessMemory functions of Windows.
I know I have to program in Objective-C, but I do not know if these functions exist in it, or if iOS has them in its libraries. Or something similar to them.
Any hints?
This will absolutely get your rejected from the app store, so there is no reason for them to exist in objective-c. If you don't need to submit the app to the app store, you will need to look into unix tools and a possible jail breaking requirement.
I am a developer working on a robotics application for iOS. I do not intend to submit this app to the app store, nor do I have any wish for suggested methods to be apple approved....
I am trying to get bluetooth working, and I think a good place to start is to try modifying the existing apple frameworks. Is it possible for me to modify the frameworks so that when they are built to my iOS device the frameworks will be modified for the app (but not other apps on the same device)?
As a matter of fact, you can!
Objective-C allows you to "swizzle" methods to override their default behavior, and yet still call the original implementation if you want to. You can do this for any number of Objective-C methods, as many times as you want.
If you wish to override behavior that is present in C functions, you will need a little bit more control over the platform. Jailbreaking allows you to use the full power of Jay Freeman's CydiaSubstrate to hook or swizzle both Objective-C methods and C/C++ functions.
While I don't recommend the use of MethodSwizzle per se, the following URL has a good discussion of swizzling http://cocoadev.com/wiki/MethodSwizzling.
But you should really use CydiaSubstrate's MSHookMessageEx and MSHookFunction instead. Especially since you're not submitting anything to the App Store.
Now regarding Bluetooth, I've done extensive work in this field (I developed Celeste, which is a systemwide tweak providing vanilla Bluetooth OBEX support to system apps on iOS). I suggest you look into using something like BTstack, which provides you with access to the bluetooth module from the HCI to RFCOMM levels, and supports things such as SDP and pairing, which you will probably need. It also has the added benefit of not requiring method swizzling, which some people seem to think is some sort of satanic ritual that should be avoided at all costs.
Aside from categories (which extend the functionality of base classes delivered in those frameworks), I don't believe you can "modify" the existing Apple frameworks per se. A better course of action might be to simply create your own framework (or find somebody else's open source, commercial or simply third party framework) and then build that framework into the app that you install onto the iOS devices you want to work with.
It's a great thing that it's possible to compile an SWF into iOS native app. I think AIR is now the best option to write e.g. small games or interactive books. Of cause AIR app will be slowler than the same app written on e.g. objective C. The question is how slower AIR app will be. Can simple AIR apps be launched e.g. on iPhone 3G or iPAd 1?
And another question is, can arbitrary flash app be compiled into iOS native app?
Will be grateful for any thoughts!!!!!
Performance of AIR vs. Objective C:
For pure script execution, AIR apps perform rather slower than native, including on iOS. However, in virtually all cases the limiting factor of your app's performance will be rendering, not script, so it depends entirely on what you do visually in your content. This is why Crooksy suggested you look at Starling. Without Starling (or similar libraries that make use of the GPU), it's pretty challenging to get decent performance out of an iPad1. It can be done, but it takes expertise and incurs extra work. It will be much better to start with the huge performance boost of using Starling or similar.
Can arbitrary flash app be compiled into iOS native app?
As long as it's made with AS3, then it should compile. For whether it works, two main caveats come to mind: First, a handful of APIs don't work on mobile devices. (I think printing is one example.) Second, if you read in any SWFs at runtime, all actionscript inside them will be ignored. (Not for technical reasons, it's an Apple requirement.) So if your content is split into a bunch of SWFs you'll need to bundle them together at packaging time, and if you absolutely depend on reading in SWFs with script from the network at runtime, you're going to hit a wall.
Hope that helps!
Check out the new Starling frame work.
http://gamua.com/
Here's the start of a nice tutorial series (episodes 1 and 2)
http://www.hsharma.com/tutorials/
Lee Brimelow also has a few tutorials
http://www.gotoandlearn.com/
Regarding converting Flash apps into iOS compatible apps, yes that is possible but it depends on what the app actually does as to whether any modifications will be needed before it will perform correctly on a device.