How to tell if your code is running on an iPhone or an iPhone3G?
The iPhone runs OS X. Here's how to determine your hardware platform on a Macintosh desktop. Here's how on an iPhone. It's the same exact thing.
In short, sysctlbyname("hw.machine", str, sz, 0, 0)
will write the platform name into str
. This happens to be "iPhone1,1" or "iPhone1,2" for the iPhone and iPhone 3G respectively.
How to determine on which iPhone my App is running?
Never coded for iPhone, but I Googled and found this: Apple Developer: UIDevice Class
Or maybe this helps: iPhone - How do I detect the iPhone version?
Distinguish iPhone 3G from iPhone 3GS
The best way to check is to use sysctlbyname("hw.machine", ...)
as per How to tell if your code is running on an iPhone or an iPhone3G?
The returned result for 3GS should be "iPhone2,1"
App Store code runs different from Xcode/Device code on iPhone 3G
So here's what I found under Build Settings:
Which, having taken a class or two in compiler optimization, makes sense. Code debugging on a device should be left in its original state for debugging purposes, and code released should be optimized for speed and efficiency.
So here's the fun part. Changing my Debug setting to Fastest, Smallest:
Causes the issue to occur on my device while running tethered in Xcode.
Before filing a Radar or making any rash decisions and submitting non-optimized code to the App Store, is there anything else I should consider investigating? Was the compiler optimization really the underlying cause of the layout issues?
Edit: And if the optimization level is the issue, why does the optimized code run properly on my iPhone 4, but not properly on my iPhone 3G?
Edit 2: This problem sounds extremely similar to this answer: Building with LLVM and any optimization causes app to crash on startup
Edit 3: Heard back from Apple Radar, this is a known issue. Will be fixed in a future version of Xcode. Thanks for all the help guys!
Target iPhone application by model (e.g. 3G vs 3GS)
There is no way to do it, except in code. Apple discourages it, instead asking you to require specific features instead of specific models.
The best you can do is note in the product description that not all features are available/performant on the 3G hardware, for example, and then disable those features in code or let them run poorly.
Detect the specific iPhone/iPod touch model
Most complete UIDevice (Hardware) category probably is http://github.com/erica/uidevice-extension/ (by Erica Sadun):
[[UIDevice currentDevice] platformType] // ex: UIDevice4GiPhone
[[UIDevice currentDevice] platformString] // ex: @"iPhone 4G"
Detect iPhone 3G or 3GS (and iPod touch 2G vs iPod touch 3G) in JavaScript
If number crunching would be a discriminator... use it! Just benchmark a small loop (call it BogoMips) and within some 0.5 seconds you know what you are up to.
The hardware and software are defined, the load is pretty much defined (well.. iOS 4 'multitasking'?), so I think it can be very accurate.
edit I only read your remarks on performance testing now; maybe you meant this exactly, maybe you meant to measure page render time. My suggestion is to have a page with only a piece of javascript which then stores the result as a cookie and redirects. Pretty much all circumstances are known then.
Jailbroken iPhone 3G with iOS 4.2.1 can't be debugged with XCode
Jailbroken 3GS / 4.2.1
I tried Matthew Frederick's recommendation without success. Anyone happened to find a solution to this problem?
EDIT
Please note that I used a jailbroken 3GS and a non-jailbroken 3GS.
Workaround, requires a non-jailbroken iPhone 3GS with 4.2.1 (8C148a):
- Delete /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148a)
- Connect the non-jailbroken iPhone 3GS with 4.2.1 (8C148a)
- Open Xcode and Organizer
- Configure the new iPhone for development by clicking the "Use for development" button in the Organizer.
- Let it extract the debugging symbols from it recreating /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148a)
- Unplug it, remove from Organizer
At this point you can debug your jailbroken iPhone again.
Cheers!
Related Topics
Watch Os 2.0 Beta: Access Heart Beat Rate
How to Change the Size of Uiactivityindicator
Ios: Determine If Device Language Is Right to Left (Rtl)
How to Generate an iOS IPA File with Ionic Framework
Open Specific View When Opening App from Notification
Disabled Uibutton Not Faded or Grey
How to Apply a Tintcolor to a Uiimage
Uirefreshcontrol - Pull to Refresh in iOS 7
Export Compliance in iOS App Submission
How to Check If a Framework Is Bitcode Supported for Xcode7
Dynamic Uiimageview Size Within Uitableview
View at the Bottom in a Uiscrollview, with Autolayout
How to Deselect a Segment in Segmented Control Button Permanently Till Its Clicked Again
Swapping Child Views in a Container View
Facebook Sdk 3.0: How to Receive User's E-Mail
How to Pause and Resume Uiview.Animatewithduration