Running blackberry app into multiple emulators at the same time - sockets

I am developing a blackberry application and I'm trying to get to devices to communicate. I am trying out the SocketDemo app and it shed light into the socket process (which is no different from any other platform so far).
Only problem is I can't test the app since I can't get the app into two different emulators. How do I accomplish this?

If you do not need to hook the second simulator into the debugger (for breakpoint setting, etc), then getting your application to run simultaneously on two simulators can be done fairly easily.
Build your application, and run it from the JDE; standard procedure.
Then, outside the JDE, start another simulator (it cannot be the same one), and, when that's up and running, choose FILE->LOAD JAVA APPLICATION from the second simulator's window menu. Select the .COD of the application you just built. The application will then be installed onto the second simulator, and will either start automatically, or you can start it by clicking on its icon (depending on how your project is set up).
With two simulators on the same machine, with applications that need to communicate through the network, it may be needed to change the ports in the .BAT file that launches the second simulator, before starting it -- otherwise, the second simulator may not be able to bind to the same ports on the machine.
Indeed, with some simulator models, you will not be able to do this unless the second simulator is from a different simulator package (different directory), because the process grabs a lock when it runs.
If you are using a built-in simulator package that only contains one simulator, you can download a second simulator, ideally a different model, from RIM's developer site: http://www.blackberry.com/developers/downloads/simulators/

Have you tried installing different JDE's and trying to run emulators from them?

Related

Testing Core Data in Watch extension on the simulator

I'm creating an apple watch app. I have created my shared framework, and the app extension. It all actually works pretty well, but when I try to query objects from my Core Data DB, i get only empty arrays.
I have already created the app groups, and made sure the DB is being saved. I just don't get any objects, or errors. However, i'm not even sure if this is testable in the simulator, since the phone AND the watch simulator don't run at the same time. I still don't have a physical watch to test so simulator is my only option.
How can I test querying CD objects from my apple watch extension? Thanks!
Here is a trick for testing both the watch and the phone on the simulator. As you pointed out, they cannot be debugged at the same time, but you can switch.
Run the phone target, then run the watch app (the phone target will terminate). Now start the phone target manually from the simulator's springboard. You are now looking at the debugging information of the watch.
To switch back and forth between the two running targets' debug output, go to Xcode and choose the desired process from the menu:
Debug > Attach to Process > (wait a second or so for the processes to populate) > Your target (which should be listed on top under the heading "Likely Targets").

Running not the same app I'm debugging?

Weird stuff happening. I'm developing an iOS app under iOS 4.2 using Xcode 3. I have the same app in two different folders and they have different xib files (because of two different languages of resources). When I'm firing up to study console logs I'm getting the other one app on device - not the one I have opened at the time... sometimes it even gets weirder: I'm starting app A, but I see on my iPhone (4S btw) intro from version A and menu from B... Meanwhile both were succesfully installed onto device, so I can manually use them separately - but not while running from Xcode.
edit: these two apps have different bundle id and names
two things:
Clean before building (Shift-Cmd-K)
The reason the other version opens on your iPhone when you build your app is that they are both sharing the same Bundle Identifier (CFBundleIdentifier) in info.plist

iOS simulate Application and log events

I want to install and simulate iOS applications and find their malware intentions. See if connects to an IP address, downloads something, API call logs and soo on... kind of everything it does on the system. Does iOS Simulator log this events, or is there any online project that does that. If not then I should do it from scratch, do you have any advice how to do this? I only have the application file, not the entire Xcode project.
ALL i have is a bunch of applications(not the projects) that i have to test. All i want is to run them and log their actions in an automated way. Just like running a windows application on a virtual machine and log api trace, internet connections, memory, registry, disk actions... IN AN AUTOMATED WAY.
Thank you.
In the iOS simulator apps simply run on Mac, but their output is shown in the iOS simulator. This means that any tool that allows you to audit Mac applications will allow you to do the same with the iOS simulator.
Check your Activity Monitor, you'll see that the app is simply listed there. I think the standard Xcode Instruments will work fine for you.
If you have the Xcode project, then look at the code and the debugger while it is running. Other than that, if you run it in the iOS simulator you will only see the GUI portion of the app, unless you are running it side by side from Xcode (then you can use Instruments or the debugger). This documentation should allow you to run the apps on the simulator.

Clean way to programmatically control Safari on iPhone?

The title say's almost all. What I have is short lived server processes that serves a web-based javascript test suite with optionally accompanying back-ends for integration tests (see here for how it's done). I'm looking for a better way to direct the iPhone Emulator's Safari to the URL given.
More, possibly optional background:
Up until iOS SDK 4.0 I've managed to control XCode using AppleScript to start a specially prepared PhoneGap project in this fashion:
AppleScript (referred to as "AS") starts XCode (referred to as "XC")
AS instructs XC to load the previously set up PhoneGap project.
AS instructs XC to launch the PhonePap project.
The PhoneGap project will redirect to the server serving the test suite, and the test suite runs.
In iOS 4.0 SDK, this only works the first round, the next time the test suite runner tries to make XC do the above routine, it fails requesting the previous run to be stopped. And I can't for the life of me find a way to stop the debugging session with AS [1], so I can only run one test suite without manual intervention, witch is pretty much a show stopper for us since we rely a lot on nightly test runs.
Now, what I really want to do is just start the iPhone Emulator, and then start Safari on the emulator with the possibility of sending an arbitrary URL to the emulated Safari.
What I've found so far is iphonesim, but I'm running into this issue and can't get it to properly start pre-compiled apps. A way to circumvent this issue in iphonesim would also be a good way forward.
[1] I'd accept a way to do this as a valid answer too.
I have a very different solution for you.
Write a custom iPhone app that just contains a web view. It will behave pretty much the same as MobileSafari. Then, embed a little web server in the app.
You can then control your app by calling specific urls on that server.
This is a very simple app. Will take you 30 minutes to put together.
This is easily integrated in Xcode or a bigger (Apple) script. You can use commands like curl to open URLs.
This is possible now:
xcrun simctl openurl booted "https://google.com"
https://apple.stackexchange.com/a/198798/144271
Post scriptum: how it was solved in the end.
A while after I asked this question, a user at github added a comment in issue 3 that what you need for iphonesim to work correctly is to give the absolute path to the application to start. So now we have a prebuilt PhoneGap project where a script modifies the contents of the www directory inside build/Debug-iphonesimulator/PhoneGap.app. The absolute path to this directory is then sent to iphonesim, starting up the project now pointing towards the correct server. No AppleScript and no XCode (except for the initial build). The test suite now takes 1/7 of the time it took to run earlier.

Installing 2 versions of app on one device

I've got two branches of an iPhone app going. I would like to load them both onto my provisioned iPad at the same time. The iPad sees them as the same app though and writes over whichever one is currently installed. Does anyone have good system for loading two versions concurrently. Thanks!
The bundle identifier is what is used to identify different applications, so if you were to temporarily change it for one of them, that build would show up as a different application than the other. It would still have the same icon, name, etc., but the system would think it was a separate application.