Showing posts with label iPhone Simulator. Show all posts
Showing posts with label iPhone Simulator. Show all posts

Monday, August 3, 2009

iSimulate

One of the difficult aspects of making an iPhone program is marketing it. One thing that helps is a professional quality video of the program in action. This is especially true for games. However, since the iPhone Simulator doesn't have access to the accelerometer, camera, or the full capabilities of the multi-touch screen, it can be difficult to get a professional looking video.

iSimulate (App Store Link) is a great option for developers. It's a standalone program that runs on your iPhone that will send the inputs from the iPhone to the simulator. This means you can run a program in your simulator and control it by touching or tilting your actual phone. This allows you to use a screen capture program to capture flawless video, even if your program uses features not available on the simulator.

Right now, you can get iSimulate for $3.99, but only for today. Tomorrow, the prices rises to $7.99 until August 8, then increases to $15.99, until August 16 when it reaches its full price of $31.99. Although $32 is still a small price to pay to get a professional quality video, if you're interested in the program, you can save yourself some money by buying now.

Monday, July 6, 2009

iPhone Simulator Application Creator

This is pretty cool. A new program called iPhoneSimulatorExchange has been released. It is designed to let you create a one-click installer of your iphone app that runs in the installer. This lets you package up your compiled application so it can be run on the simulator of another machine that has the iPhone SDK and dev tools installed. A very neat, and useful idea. I'm looking forward to trying it out.

via Adrian Kosmaczewski.

Wednesday, January 7, 2009

Accelerometer in the Simulator?

I haven't tried this out yet myself, but it's a very cool idea. This blog post explains how to make the iPhone simulator use your laptop's accelerometer, which fills one of the few holes in the simulator's functionality.

Friday, November 21, 2008

Adding Photos to iPhone Library

Here's a tip I picked up from the iPhoneDevSDK forums courtesy of member hikinks.

The iPhone simulator comes with some sample images installed so that you can use and test the Image Picker and other functionality. The only problem is, if you clear the cache, or delete the ~/Library/Application Support/iPhone Simulator folder, you lose them.

You can put any photos you want in the library, however, to get them to show up, you need to put them in the right place and give them the correct names. Place your images in
~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE

creating any folders that do not exist.

Now, rename the image files you want in your simulator's photo library using the following naming convention:

IMG_0000.JPG
IMG_0001.JPG
IMG_0002.JPG

Remember - unlike the Mac, the iPhone's file system is case sensitive, so make sure you use uppercase letters.

That will put them in the photo album. You do not see thumbnails though. To get thumbnails, you have to manually make re-sized copies of each image that are resized to 96x96 pixels. The thumbnail for a particular image should have the same name as the image it is a thumbnail for, but instead of a .JPG extension, it should have a .THM extension.


The Of Code and Men blog has a bash script that will functions for copying the files onto the simulator.

Edit: I've been told that there's an easier way - that you can simply drag an image onto the Simulator window when it's running and that will open the image in Mobile Safari and then let you add the image to the Simulator's Photo Library. I've found that to be half true - I can get the image from my computer to open in Mobile Safari in the Simulator, but the path from there to the Photo Library is not obvious to me if it exists.

Monday, October 20, 2008

Device vs. Simulator

The iPhone Simulator is a really cool piece of software. Although I do most of my development testing on an iPhone or iPod Touch, I really like having the option to run code when I don't have a device handy. It's a really cool piece of technology.

Sometimes, it can be downright annoying, though. Today, I hit an example of that. I'm working on a project that needs to run on both the Mac and the iPhone, and it does a fair bit of mucking around in the runtime. I've written programs using for both the Mac and the iPhone with no problems, but periodically would get e-mail from someone asking if I could make it work for the iPhone.

Well, it turns out *blush*... I must have never actually tested the code on an iPhone or iPod Touch, and only used this particular code in the simulator and on the Mac. You see, I have this line of code:


#import <objc/objc-runtime.h>


And that code works just fine and dandy for the Mac, and for the iPhone Simulator. But, guess what? obj/objc-runtime.h doesn't seem to exist in the iPhone SDK, so when you switch the SDK to the device and then compile, the build goes down in a blaze of gory (no, not glory, gory... it's ugly).

Fixing it was relatively trivial once I found the problem. The file objc/objc-runtime.h is a very simple header file. Here is what it looks like on the Mac:

#import <objc/runtime.h>
#import <objc/message.h>


That's it. And both of those files do exist for the device SDK. So, I simply replaced the one #import <objc/objc-runtime.h> statement with the two #import statements it contained, and voilá, it started working again. Mostly.

It compiled with no errors, but I got a whole bunch of warnings, all centered around the use of two methods it couldn't find: -className and +className. These methods do nothing more than return the name of the class, one is implemented as an instance method, the other as a class method. I have no idea why these two methods don't exist for the device SDK, but this was also easy enough to fix, since the class name is available through runtime calls.

I added the two methods, but wrapped the code in a pre-compiler conditional statement so it only gets used when compiling for the iPhone:

So, in the header file:

#if (TARGET_OS_IPHONE)
- (NSString *)className;
+ (NSString *)className;
#endif


Currently, this resides on the class where I needed it, but I'm going to move it into a category on NSObject. The implementation of these two methods is nearly as short:


#if (TARGET_OS_IPHONE)
- (NSString *)className
{
return [NSString stringWithUTF8String:class_getName([self class])];
}
+ (NSString *)className
{
return [NSString stringWithUTF8String:class_getName(self)];
}
#endif


And that's all for today, I'm going to bed.

Simulator

I thought everybody knew this by now, but I have encountered two people recently who have been developing for the iPhone for a while and who didn't know this, so here it is. Sorry if I'm being Captain Obvious.

If you want to simulate a two-finger gesture in the iPhone simulator, hold down the option key. You will get two dots on the screen instead of one. The two dots will default to pinching - if you bring the dot closer to the center of the screen, the other dot comes toward the center, making it easy to simulate a pinch in or pinch out.

If you want to do a different two-finger gesture, get the two dots the distance apart that you want them to be, then hold down the shift key, while still holding down the option key. That will lock the position of the two finger presses together so you can do, for example, a two-finger swipe.

Still don't know a way to do three-or-more finger gestures, or complex two-finger gestures, but the use of the shift and option key should cover about 95% of the gestures you'd need.