2

I've to de-compile iOS .app file and then insert my code and then re-package back to ipa file.

Can you please suggest some pointers how to do it?

iamMobile
  • 959
  • 2
  • 17
  • 35
  • 2
    You can't is the simple answer. Compiling objective-c is a one way street. Feel free to disagree those with a complicated answer. – Ben Clayton Jun 28 '12 at 15:37
  • http://stackoverflow.com/questions/1976699/decompile-iphone-app-binary also just to set things straight an ipa is just a compressed file, you can easily right click and say "show contents" .app is different though – owen gerig Jun 28 '12 at 15:38
  • @owengerig yes, but you cannot alter them (neither code nor resources, as far as I remember, but certainly not code), resp. as Nima mentions, it will alter the signature used to sign the application and there isn't a way to make that work on an unmodified iOS device. Also, there simply isn't a way to "decompile" an IPA, its not gonna happen. – Fuggly Jun 28 '12 at 16:09
  • But then how mocana (mocana.com) and Apperian are doing it? Please check their websites. – iamMobile Jul 01 '12 at 12:07

2 Answers2

5

You simply can't do this.

Once the app is compiled down to machine code, the best you can get from reverse engineering it is just assembly and unless you are willing to write your fix in assembly I don't see how you are going to integrate your code.

Also the code signing will be corrupted by doing this as well. Unless you have valid provisioning set up on your machine you can't repackage the app with the original code signing.

Try to get the source or similar source to write an app with the functionality you need.

Nirma
  • 5,640
  • 4
  • 35
  • 47
3

Yes you can if the device is jailbroken and the signature check is removed.

Here there is one case:

Is it possible to edit and recompile an iOS Binary?

In the reply they suggest that the modifications have been taken directly on the binary (by replacing some functions with other of the same size). However, I believe that you can do more advanced things.

You could, for instance, include the assembly of the application into your own objective-c code using XCode:

Compiling Assembly (.S) file alongside iPhone project

Or directly compile the modified assembly into the binary (mach-o) and then repackage.

How to create an iPhone mach-o file?

Maybe GNU ARM or LLVM toolchain can assit you on doing this: Compile, Assemble and Disassemble Using the LLVM Tool Chain

There are just some approaches which I'm currently investigating on. It is not straightforward, so any other know-how on the topic will be very appreciated.

Community
  • 1
  • 1
gtangil
  • 717
  • 7
  • 7