Friday, April 27, 2012

Is there a way to simulate multiple iphones using xcode/iphone sim?


I'm planning out a game that requires multiple users and I was wondering if there's a way to fire up multiple instances of the iPhone Simulator. I didn't see anything in menus or in Google search results, but I just wanted to make sure I wasn't missing anything.



Source: Tips4all

6 comments:

  1. As near as I can tell, not only can you not have multiple instances of the simulator running, but when time comes for actual device testing you can't have multiple instances of the debugger running either.

    This means to do multi-device apps, you'll need to have a single Mac assigned to a single iPhone/touch device (or simulator instance) each running your app.

    I've started looking into whether VMWare or Parallels can somehow be brought into this, but there's not much that can be done without hacking the OS.

    I suggest filing a feature request with http://bugreporter.apple.com.

    ReplyDelete
  2. It is possible but only with multiple users.

    Read this: http://www.coderebel.com/2010/08/31/iphone_simulator

    Assuming you have two projects (P1,P2) which you want to debug simultaneously, do as follows.

    Steps to set up:


    Create a new user (U2) on your Mac
    Give it R/W access to P2, especially to its build folder.
    Download the launcher app from the site above and copy it to Applications.


    Steps to debug:


    Close Xcode and the simulator if running
    Launch the iPhone Launcher.app with U1.
    Start Xcode with U1, load P1, start debugging.
    Launch the iPhone Launcher.app with U2.
    Start Xcode with U2, load P2, start debugging.


    Unfortunately it's a P.I.T.A. having to change users every now and then but so far I haven't found any better solution. Hope this helps.

    ReplyDelete
  3. Another option (albeit probably overkill) if you have a Mac OS X server license is to virtualize an instance of Mac OS X Server, and run a second simulator in the VM.

    ReplyDelete
  4. Hmm...I don't think you are missing anything here. As far as I know there is no technology within the SDK that is able to emulate multiple devices -- though that would be a useful feature to have. I think your only options would be to get a second iPhone OS device, or get a friend who also has an iPhone OS device to let you use it for testing.

    ReplyDelete
  5. Follow these steps to test your app.

    You have to do one thing for whole process first :
    Go to Project - > Edit Project Settings -> tick on option - Build independent targets in parallel.


    Debug code that will create your app in simulator For Example your App name is - Instance
    Close Simulator
    Go to Project->New Target -> Instance2
    Add "Bundle display name : Instance2" in Instance2.info.plist file
    Set Executable Name : Instance2
    Select Instance2 Target -> Go to Project -> Set Active Target -> Instance2
    Build with Instance2


    Note : Do all carefully otherwise you have to reset your simulator
    For Reset Simulator -> Run Simulator -> iPhone Simulator -> Reset Content & Settings...

    Now You have two apps in simulator and you can test app on all instance.

    Hope it will help you :)

    Ravikant Nagar

    ReplyDelete
  6. In XCode 4 you can run multiple instances while having both be in debug mode.

    What I did was create a duplicate of my target and ran both the original and the duplicate. If you're using the output window you can toggle which output you are looking at.

    ReplyDelete