Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
Does anyone know if it's possible to make two versions of the same app (same title) - one for the iPhone and one for the iPod touch? If so, how would you do this? would you submit two different apps? Would both apps show up in the app store under the same title and the device would automatically choose?

Thanks.
 

Jeremy1026

macrumors 68020
Nov 3, 2007
2,215
1,029
Does anyone know if it's possible to make two versions of the same app (same title) - one for the iPhone and one for the iPod touch? If so, how would you do this? would you submit two different apps? Would both apps show up in the app store under the same title and the device would automatically choose?

Thanks.

Why not just build your app to interact with touches differently then phones?
 

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
I'm not quite sure what you mean, but there's only a small difference that I need for for the two devices on my app. I have an image view, and for an iPhone, I want it to load a certain image, and for an iPod touch, I want it to load a different image. Is there anyway I would be able to do that without having the user go into some sort of preferences?
 

nottooshabby

macrumors 6502
Jul 12, 2008
416
90
I'm not quite sure what you mean, but there's only a small difference that I need for for the two devices on my app. I have an image view, and for an iPhone, I want it to load a certain image, and for an iPod touch, I want it to load a different image. Is there anyway I would be able to do that without having the user go into some sort of preferences?

I'm pretty certain you can query the device to find out what it is, then use some simple if and else logic.
 

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
So how would I fit that into an ApplicationDidFinishLaunching method? I'm sorry I'm sort of new at programming
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
So how would I fit that into an ApplicationDidFinishLaunching method? I'm sorry I'm sort of new at programming
If you're not sure how to put together a simple if-then-else test that is based on the property of a built-in class, I would suggest that you need to spend a bunch more time learning the basics of Objective-C coding before you go much further. Being new to programming is not a bad thing. It just means you have some learning to do before you can be competent enough to start coding that next-great iPhone app. You could start by looking at the stickies and guides at the top of this iPhone Programming forum.
 

Jeremy1026

macrumors 68020
Nov 3, 2007
2,215
1,029
If you're not sure how to put together a simple if-then-else test that is based on the property of a built-in class, I would suggest that you need to spend a bunch more time learning the basics of Objective-C coding before you go much further. Being new to programming is not a bad thing. It just means you have some learning to do before you can be competent enough to start coding that next-great iPhone app. You could start by looking at the stickies and guides at the top of this iPhone Programming forum.

I think his problem is getting the device, no the if statement.

Code:
UIDevice *myCurrentDevice = [UIDevice currentDevice];
NSString *theDevice = [NSString stringWithFormat=@"%@",[myCurrentDevice model]];

That will return either iPod Touch, iPhone, or Simulator depending on which device it is on.

Then you will simply compare the strings against @"iPhone" or whatever and perform the proper image loading for the device.
 

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
I think his problem is getting the device, no the if statement.

Thank you. It was partly my fault, I phrased the question poorly, but I'm glad you understood me. I would consider myself fairly competent in understanding Objective-c, I'm just not completely familiar with all of the Cocoa and Cocoa touch methods
 

I'm a Mac

macrumors 6502
Original poster
Nov 5, 2007
436
0
Thanks you so much for all of your help. Now, it appears I'm having an Objective-C issue. For some reason, even though I can get the model name, my iPhone won't respond to the if loop for it's correct model name (it just goes to else)

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {    
	
	UIDevice *myCurrentDevice = [UIDevice currentDevice];
	NSString *theDevice = [NSString stringWithFormat:@"%@",[myCurrentDevice model]];
	NSLog(@"The current model is %@", theDevice);
//The Debugger logs that the model is indeed an iPhone
	
	if (theDevice == @"iPhone") {
		NSLog(@"Using the iPhone");
//That is not getting logged
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Try
Code:
if ([theDevice isEqual:@"iPhone"])
instead.

The == is simply comparing pointer values, which will always be different for your code since you're allocating theDevice's own memory space through the stringWithFormat call.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.