Posts

Showing posts from April, 2013

Launch iPhone simulator without Xcode.

To launch simulator you have to way. 1. Using Terminal 2. Using UI. 1 Using UI. ->    Open Finder and then press   shift +  cmnd + g   or Go -> Go to Folder then enter this address /Applications/ Xcode . app / Contents / Developer / Platforms / iPhoneSimulator . platform / Developer / Applications the double click on simulator.app. 2 Using Terminal  Open terminal and then press this command open / Applications / Xcode . app / Contents / Developer / Platforms / iPhoneSimulator . platform / Developer / Applications / iPhone\ Simulator . app or open `xcode-select --print-path` / Platforms / iPhoneSimulator . platform / Developer / Applications / iPhone\ Simulator . app To run application follow this, http://cocoamanifest.net/articles/2011/12/running-your-ios-app-in-the-simulator-from-the-command-line.html

How to find iPhone/iPod Device model(3G,3GS,4,4S) by code

#import <sys/utsname.h> NSString * machineName () { struct utsname systemInfo ; uname (& systemInfo ); return [ NSString stringWithCString : systemInfo . machine encoding : NSUTF8StringEncoding ]; } Get Result of this using  NSLog(@"Running on device = %@",machineName()); You can also match result with - ( NSString *) platformString { NSString * platform = [ self platform ]; if ([ platform isEqualToString :@ "iPhone1,1" ]) return @ "iPhone 1G" ; if ([ platform isEqualToString :@ "iPhone1,2" ]) return @ "iPhone 3G" ; if ([ platform isEqualToString :@ "iPhone2,1" ]) return @ "iPhone 3GS" ; if ([ platform isEqualToString :@ "iPhone3,1" ]) return @ "iPhone 4" ; if ([ platform isEqualToString :@ "iPhone3,3" ]) return @ "Verizon iPhone 4

NSThread

There are two ways to create a thread using the  NSThread  class: Use the  detachNewThreadSelector:toTarget:withObject:  class method to spawn the new thread. Create a new  NSThread  object and call its  start  method. (Supported only in iOS and OS X v10.5 and later.) Both techniques create a detached thread in your application. A detached thread means that the thread’s resources are automatically reclaimed by the system when the thread exits. It also means that your code does not have to join explicitly with the thread later. Because the  detachNewThreadSelector:toTarget:withObject:  method is supported in all versions of OS X, it is often found in existing Cocoa applications that use threads. To detach a new thread, you simply provide the name of the method (specified as a selector) that you want to use as the thread’s entry point, the object that defines that method, and any data you want to pass to the thread at startup. The following example shows a basic invocation