NSLog datatype formatting option in Objective-C

NSLog in Objective-C is function call that is useful during debugging of a program. A typical NSLog example is NSLog(@" How to use NSLog"); The above statement prints the message " How to use NSLog " in console window. If you want to print the value of Objective-C variable or data type then you need […] Read More

Different data types in Objective-C

Objective-C like any other programming languages has different data types like int, float, double, char and id. Data types are used for specifying the kind of data that is being stored in a variable. For example, the below code stores a single character to a variable "flag" char flag = '1' Data type - char […] Read More

XCode’s iOS Simulator for iPhone and iPad

iOS Simulator in Xcode can be used for testing iOS apps before trying the apps on a live device. Listed below are the different settings and features on iOS Simulator. Launching iOS Simulator iOS Simulator can be launched by executing Program on Xcode Run Program on Xcode : Keyboard Shortcut is Command + R, Menu […] Read More

‘NSInvalidUnarchiveOperationException’, reason: ‘Could not instantiate class named MKMapView’

Problem :- Xcode project with MapView control displays the error "'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named MKMapView'" Solution :- The 'Could not instantiate class named MKMapView' error is displayed when the Xcode project with MapView control on xib does not include the MapKit library as part of the Link Libraries. Select the Xcode project […] Read More

Objective-C – What are Categories?

Categories in Objective-C are used for adding extra functionality to a class without accessing the source code of the class and without subclassing it. Let us see this with an example by adding an additional method to NSNumber that just writes the value of the NSNumber argument to NSLog. Create Project Create a new Command […] Read More

How to only enable portrait orientation for iPhone App

When developing an iPhone app in Xcode, if you have any requirement that only portrait orientation allowed then you can do the following. Step 1: Open the implementation file for editing. Step 2. Navigate to shouldAutorotateToInterfaceOrientation method. This methods is auto generated by Xcode while creating the project. Step 3: replace the return statement with return (interfaceOrientation == UIInterfaceOrientationPortrait);. […] Read More

How to rename default view controllers in XCode

Xcode by default provides default name for the view controllers depending upon on the selected projects templates. For example, while creating Tabbed Application, you will find FirstViewController and SecondViewController as the name for default view controllers. Now if you want to provide a proper name to the FirstViewControllers and SecondViewControllers you can use the Rename […] Read More

XCode – Open file in same window on double click

Xcode by default displays project file in a seperate window when the user double clicks on the file. And if you want to change this behavior and to open the file in the same window as that of single click then you can use the options provided as part of Xcode Preferences. Step 1: Launch […] Read More

Provisioning iPhone 4S for deploying and testing Apps

Listed below are detail steps for provisioning iPhone 4S for deploying and testing Apps. The steps have been broadly classified in to the following topics. Requesting Development Certificate Submit Certificate in iOS Provisioning Portal Installing Certificate Registering Device to Provisioning Portal Requesting Development Certificate Requesting development certificate requires you to generate a Certificate Signing Request […] Read More

Apple Mach-O-Linker Id Error – OBJC_CLASS_$_MFMailComposeViewController

Xcode displays the Apple Mach-O undefined symbols for architecture error when the library referred in the code is not included as part of Build Phases. For example, I was instantiating MFMailComposeViewController in one of my project   MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init]; And while trying to compile the code, the build failed and displayed the […] Read More

1 8 9 10