Thursday 7 February 2013

Install app or ipa file on iPhone simulator

Hey guys,
Today we learn how to install the .app or .ipa file in your simulator.

Following are the steps : 
1) Finder -> Go ->Press alt option (key) -> Library -> Application Support -> iPhone Simulator -> Go to your simulator (It may be 4.0, 5.0, 6.0)

2) If you have folders inside  this path ( Finder -> Go ->Press alt option (key) -> Library -> Application Support -> iPhone Simulator ) then, delete all the folders. It  may clear you after your Xcode build.

3) Suppose you are having a Xcode project whose name is "Test" and you select your scheme as iPhone 5.0 Simulator, then Build + Run your project. 

4) After that you follow 1 & 2 steps ( Finder -> Go ->Press alt option (key) -> Library -> Application Support -> iPhone Simulator ->  5.0 -> Applications -> Randomly 32 digits folder (i.e E8CD6A90-008A-4744-96D1-A104BB44C136) -> Copy 4 items (i.e Documents, Library, tmp, Test file) )

Requirements : You need 4 files ( i.e  Documents, Library, tmp, your binary file (.app) )

Now, if you install this Test binary file onto another mac.

1) You just only need to replace these 4 files into your running Xcode Project.
2) Quit the simulator, if it is already open and then copy 4 files into  this path : Finder -> Go ->Press alt option (key) -> Library -> Application Support -> iPhone Simulator ->  Depends upon what scheme you are running (4.0/5.0/6.0) -> Applications -> Randomly 32 digits folder -> Replace with NEW 4 Files here
3) Open the simulator, No you see "Test" app in your simulator. 


**NOTE**
Above steps/approach works only before Xcode6.

Updated steps:

Actually, Above Xcode 6 simulator devices are located in "~/Library/Developer/CoreSimulator/Devices/"
Browsing directory to your app's Documents, tmp, library folders and binary file are a bit more arduous. Please follow below points to make it work

1) You can find Documents, Library, tmp folders here :
~/Library/Developer/CoreSimulator/Devices/<SIMULATOR_DEVICE_ID>/data/Containers/Application/<SIMULATOR_DEVICE_ID>/

2) Replace your Binary file here:

/Library/Developer/CoreSimulator/Devices/<SIMULATOR_DEVICE_ID>/data/Containers/Bundle/Application/<SIMULATOR_DEVICE_ID>


Enjoy
Cheers :)

17 comments:

  1. can i use this method to install any ipa file? like facebook app or twitter app in the iOS simulator?

    ReplyDelete
  2. actually i have "AdhocBuildFiles" this zip file unzipped this file i got 2 file 1 is "AdhocBuildFiles" another one is "__MACOSX"

    Q:Explain me now how to deploy in to simulator?

    ReplyDelete
    Replies
    1. just copy and paste these folder files except MACOSX into the corresponding path, which you want to run.
      follow the above steps, hoping this works :)

      Delete
  3. this doesn't work for ipa, it appear on simulator, but can't run, just exit after run.

    ReplyDelete
    Replies
    1. Henchr,
      Please read blog post steps carefully, I think you missed one of points.
      First, delete the application from simulator on which you paste your .ipa file, and then clean all targets.
      Hope this works :)

      Delete
  4. I have build my .ipa file with device (not in simulator). Is it possible to install this ipa in iphone simulator? I tried but can't run, just exit after run.

    ReplyDelete
    Replies
    1. not possible dude.
      You must need Documents,Library,tmp files for that, you have only .app right?
      That's why exit after run.

      Delete
  5. good work budy......thanks a lot ......

    ReplyDelete
  6. Hi there,
    is this still work in OSX 10.9 & XCode 5.01 with iPhone 7.03 simulator??

    ReplyDelete
    Replies
    1. If you are still looking for answer, I have updated steps for above iPhone6 simulator under Note section

      Delete
  7. NO options available(Iphone simulator folder) in mac mini pro yosemite - help me

    ReplyDelete
    Replies
    1. Actually, Above Xcode 6 simulator devices are located in:
      "~/Library/Developer/CoreSimulator/Devices/"
      Browsing directory to your app's Document, tmp, library and binary file is a bit more arduous. Please follow below points to make it work

      1) You can find Documents, Library, tmp folders here :
      ~/Library/Developer/CoreSimulator/Devices//data/Containers/Application//

      2) Replace your Binary file here:
      /Library/Developer/CoreSimulator/Devices//data/Containers/Bundle/Application/

      Hope it works.


      Delete
  8. Hello!
    I have an ipa file from Appstore. Is it possible to launch it via simulator using your method?

    ReplyDelete
    Replies
    1. It's called Decompiling an app. You won't get exact source code. iPhone apps or the ipa files are DRM protected by Apple. It's not easy to do that. You'll certainly need a jailbroken iPhone to extract DRM free ipa.

      Delete
  9. i have jailbroken iphone, but decompiling is not an option. I've never done any reverse engineering.
    As far as i understand ipa is an archive format for precompiled ARM binary code. So, there is no way to do this.
    Thank you.

    ReplyDelete
    Replies
    1. If it was downloaded from iTunes store, you can't run ipa on simulator because the ipa file is compiled for a phone's ARM architecture, not the simulator's x86 architecture.

      Delete