Friday, April 29, 2011

How to find the own phone number in Iphone

NSString *phoneNumber = [[NSUserDefaults standardUserDefaults]
stringForKey:@"SBFormattedPhoneNumber"];
 
NSLog(@"Phone Number: %@", phoneNumber);

Thursday, April 28, 2011

Verifying iTunes video conversion and video syncing using sample QuickTime files

Verifying video conversion in iTunes

iTunes includes the capability to convert some movies into a format that can be played on your iPhone, iPad, iPod, or Apple TV that supports video playback. To verify that videos you convert using this feature play correctly, follow the steps below:
  1. When the conversion is complete, iTunes will create a copy of your movie in your iTunes library. There will be two movies listed with the same name. The sample_iTunes file with a kind of "MPEG-4 video file" is compatible with your device.
  2. Download this QuickTime sample movie: sample_iTunes.mov (right-click or Control-click this link and save it to your desktop). If you are using Internet Explorer, choose Save Target As from the shortcut menu. If you are using Safari, choose Download Linked File from the shortcut menu. Note: If the movie starts to play in a browser window, click Back and try again. (Make sure you hold the Control key down while clicking if you don't have a right button on your mouse).
  3. Open iTunes and add the sample movie "sample_iTunes.mov" to your Library. Note: The file may also appear as simply "sample_iTunes." To add the movie, open iTunes and choose Add to Library from the File menu.
  4. Locate and select the "sample_iTunes" file in iTunes.
  5. From the Advanced menu, choose Create iPod or iPhone Version or Create iPad or Apple TV version. While converting, you will notice an item named "Converting..." appear in the list on the left.
    The "Converting..." item disappears after the conversion is over.

Free Software for Mac os

Web Browsing

firefox

Mozilla Firefox

The premier free, open-source browser. Tabs, pop-up blocking, themes, and extensions. Considered by many to be the world's best browser.
Download Page

Video Player, Torrents, Podcasting

miro

Miro

Beautiful interface. Plays any video type (much more than quicktime). Subscribe to video RSS, download, and watch all in one. Torrent support. Search and download from YouTube and others.
Download Page

IM - Instant Messaging

adium

Adium

Connect to multiple IM accounts simultaneously in a single app, including: AOL IM, MSN, and Jabber. Beautiful, themable interface.
Download Page

Video Converter, iPhone Converter

video converter

iphone interview questions

—- Objective-C related —-
  • identify basic OO concepts and the keywords Objective-C uses (interface, implementation, property, protocol, etc)
  • what is a designated initializer, what is the pattern for the initializers and why ( if (self = [super ...] ) )
  • basic memory management topics, like ownership retain/release/autorelease
    • what happens if you add your just created object to a mutable array, and you release your object
    • what happens if the array is released
    • what happens if you remove the object from the array, and you try to use it
  • trick: garbage collection on iPhone
  • autorelease pool usage
  • property declarations ( assign, nonatomic, readonly, retain, copy )
    • trick: ask about the nonexistent atomic keyword, what does atomic mean
    • ask on how to correctly implement a retaining setter property
    • ask about the circular reference problem and delegates being usually saved with assign rather then retain

Wednesday, April 27, 2011

Creating custom UITableViewCell Using Interface Builder [UITableView]

Just like user select one row and that row text will be set as product text in next view. Out put of this tutorial will look like this
Picture 11 iPhone Tutorial: {Part 2} Navigatation in UITableView



Picture 12 iPhone Tutorial: {Part 2} Navigatation in UITableView

1. You have to add NavigationController in your application to move from one screen to other. Its really an easy way to navigate from one view to other. So in this tutorial I am going to use UINavigationController. Open ‘SimpleTableAppDelegate.m’ file and change the function ‘applicationDidFinishLaunching’ so that it looks like this:
- (void)applicationDidFinishLaunching:
(UIApplication *)application {
UINavigationController *navController = 
[[UINavigationController alloc] initWithRootViewController:viewController];
// Override point for customization after app launch
[window addSubview:navController.view];
[window makeKeyAndVisible];
}
2. Open the SimpleTable code(you can grab it from here). Right click on classes folder in Xcode and select ‘Add > New File…’.

Tuesday, April 26, 2011

Gyroscope - iPhone

While the entire world was giddily anticipating the start of World Cup soccer this year, it was nose to the grindstone here at Sourcebits developing new soccer madness updates of Funbooth for Mac and iPhone.  Work notwithstanding, our development team had serious fun during production of these applications.  Throughout the beta testing and QA we were constantly capturing images of ourselves in the props of the teams we support, and we made the most of the new social features with the on-the-fly uploading to Facebook and Twitter.  And at the same time, our gaming wing guys at Wandake were busy putting the finishing touches on their now-huge hit Wake Up the Box! for iPhone and iPad.  So it was a real party at times.

While all this was going on, of course there was some big news on June 7, when Steve Jobs introduced yet another Apple engineering marvel: iPhone 4.  Bundled with new features like front-facing camera, superior rear camera, dual mikes for increased noise cancellation, eye-popping Retina Display, multitasking, 720p HD video recording and even a new kind of gyroscope technology, iPhone 4 is a huge evolutionary step in smartphone design.  As the tag line says: “This changes everything.  Again.”  And, marketing hyperbole aside, as far as day-to-day use is concerned for sure this will change the way we use iPhone.
Before this year’s launch, several leaked – or mislaid – iPhone 4 models made the rounds of the major tech blogs, complete with gory dissections and the standard tsunami of specu-babble.  But there was one stealth feature all the teardowns and pundits failed to even guess at: the gyroscope.  And on our side, as veteran iPhone developers, when Steve Jobs announced this during WWDC we were all pretty excited.  And while it still hasn’t gotten much attention in the press, this feature is a game changer in iPhone’s rivalry with Android and Symbian devices.

Apple’s been pioneering smartphone innovations since iPhone’s introduction in 2007 with many widely imitated micro-technologies, in particular the accelerometer.  The accelerometer is a type of sensor that detects changes in a device’s orientation, vibration, rotation or fall by detecting linear acceleration along one of the three X, Y and Z axes – that is: up/down, right/left, and front/back.

3-axis accelerometers enable features we by now take for granted in smartphones (and lately, too, in non-Apple branded consumer digital cameras, music players, and gaming peripherals).  For example, landscape/portrait orientation shifting, tilt for directional control in games and applications, and shake features for refreshing a webpage or shuffling a playlist.  The 1st generation of accelerometer – pre iPhone 4 – could measure only linear motion; it couldn’t sense direction on a compass or twisting motions or rotation, nor had any notion of gravity.

Then last year Apple added a magnetometer to the iPhone 3Gs, enabling it to sense magnetized direction relative to the Earth’s poles. And now, with the introduction of the gyro in iPhone 4, Apple once more ups the ante in spatial detection / orientation with a new sensor for detecting 3-axis angular acceleration around the X,Y and Z axes, enabling far more precise virtualization of pitch, yaw and roll on iPhone.
While detection of change in velocity has been possible for some time thanks to conventional accelerometer calculations in terms of linear acceleration, the gyroscope has been designed to detect angular acceleration, which will detect change in both velocity and direction at the same time.  iPhone 4’s gyroscope enables the sensing of even slight degrees of rotation while simultaneously rejecting linear movements and hand jitters – both still ably handled by accelerometer’s linear movement detection technology.
Combining the 3 axes of the gyroscope along with the 3 axes of the accelerometer now enables iPhone to recognize distance, speed and direction as it moves real-time through space. And thanks to the CoreMotion APIs in iOS, developers with the vision to make use of gyroscope data can access it freely, as some have already done.

3 Excellent Books on iPhone Development

iPhone has been a rage among users ever since it was launched in 2007 and it continues to be the leading mobile device today with millions of applications in the App Store. It has revolutionized mobile computing by giving everybody an opportunity to develop their own applications for the platform. You probably want to develop your own iPhone application, but the question is – Where to begin? There are hundreds of books available on iPhone programming, but not all of them are good enough to give you a quick head-start. In this article, we’ll tell you about three excellent book on iPhone development, which can quickly get you started with iPhone (and even iPad!) application development. 1. Beginning iPhone Development: Exploring the iPhone SDK
This is perhaps the best book for beginners in iPhone development. The book starts with the basics, walking you through the process of downloading and installing Apple’s free iPhone SDK, then stepping you though the creation of your first simple iPhone application. You’ll move on from there, mastering all the iPhone interface elements that you’ve come to know and love, such as buttons, switches, pickers, toolbars, sliders, etc. It will also introduce you to some more advanced topics like GPS API’s and accelerometer. It’s really a must have book for anyone interested in getting started quickly and efficiently with iPhone development. 2. iPhone Programming – The Big Nerd Ranch Guide

This book leads you through essential tools and techniques for developing applications for iPhone, iPad and iPod Touch. You’ll learn about mapping services, accessing accelerometer data, handling multi-touch gestures, ways of sorting and loading data, communication with web services and localization. The book has numerous visual cues and code samples, which will help you get a hang of iPhone programming. It really deserves a place on your bookshelf.
3. Programming in Objective C

The book is not iPhone specific, but it’s still very useful as you need to have a solid foundation in Objective C if you want to develop some really cool iPhone applications. The book assumes no prior programming knowledge and serves as an excellent guide for beginners. You’ll learn about the basics of Objective C programming, Foundation Framework and Cocoa and iPhone SDK.The separation of these main topics, Objective-C Language features and the Foundation Framework for example, almost guarantees that there won’t be much confusion if you are learning the language for the first time and that there will be a distinction between the topics and concepts for each section.

Monday, April 25, 2011

Objective-C Programming in XCode 4 – iPhone iOS 4.3 Hello, World ! tutorial


DemoViewController

1. Install Xcode and create a new project

To develop apps for the iPhone/iPad running iOS, you’ll need a Mac running Mac OS X 10.6.
Apple’s development tools are called Xcode. This tutorial is for Xcode 4, released in March 2011. Please note that you’ll find lots of information on the internet which is valid only for version 3 or 4 of Xcode.
To run your apps on hardware devices, you need to be member in the iOS Developer Program (99$/year). If you are member in the developer program, you can download Xcode 4 for free. If you’re not a member, you can still buy Xcode 4 for $4.99 in the Mac App Store and run your apps in the simulator on the Mac.
So, first step is to download and install Xcode 4 and to run it from /Developer/Applications/Xcode:
Xcode

Base64 encoding options in iPhone / iPad

Base64 is an encoding for transferring binary data in 7-bit text. Originally used in email, it is also used for binary encoding data in HTML files. Another common use for Base64 is in HTTP Basic Access Authentication where it is used to transfer login details (which might not be printable characters).

The key library for handling Base64 on the Mac is normally libcrypto (the OpenSSL library), so it's a little disappointing that libcrypto isn't available on the iPhone.

Using OpenSSL

Via the command line

On the Mac, you can handle simple encoding tasks like base64 encoding with OpenSSL on the command line:

echo "Base64 encode this text." | openssl enc -base64

gives the encoding result:

QmFzZTY0IGVuY29kZSB0aGlzIHRleHQuCg==

The reverse is handled in the following manner:

echo "QmFzZTY0IGVuY29kZSB0aGlzIHRleHQuCg==" | openssl enc -d -base64

giving

Base64 encode this text.
In code

As you'd expect, doing the same work in code takes a little more typing. First, we're using a library, so we need to include it (in your Project's Build Settings under Other Linker Flags add the flag -lcrypto). Once that's done, you should be able to use the following method in a category on NSData:

#include 
#include 

- (NSString *)base64EncodedString
{
// Construct an OpenSSL context
BIO *context = BIO_new(BIO_s_mem());

// Tell the context to encode base64
BIO *command = BIO_new(BIO_f_base64());
context = BIO_push(command, context);

 

Tuesday, April 19, 2011

Adding Multiple Buttons to an Alertview and specifying their actions

Step 1. Open up our alertview project.. if you haven’t done that yet please watch the tutorial on that and then comeback

Alertview Tutorial:CLICK HERE

Step 2. Navigate to the (***ViewController.m)- the stars just represent the name

Step 3. Navigate to the alertview action (where the code is) it should look something like this

-(IBAction)pushAlert {

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@”This is a alert view” message:@”Watever” delegate:nil cancelButtonTitle:@”Cancel” otherButtonTitles:nil];
[alert show];
[alert release];

}

How to Create UIAlertViews

In the header file (***ViewController.h)

-(IBAction)pushAlert;

In the (***ViewController.m)

-(IBAction)pushAlert {

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@”This is a alert view” message:@”Hi my name is bob. I like to code random projects for the iPhone” delegate:nil cancelButtonTitle:@”Cancel” otherButtonTitles:nil];
[alert show];
[alert release];
}




How To Switch Views using Multiple Viewcontrollers

1) Open up XCode > New Project > View Based Application

2) Call it SwitchViews and hit Save If you look under your resources folder, you can see Xcode already gives you new NIB (.xib) files, and already interconnects them New Project

3) Now we need to add another NIB file, but first lets add the class files first. Click File > New File UIViewController subclass. Call it NextView.m and hit Save. (check the box that says create .h too)

Add Subclass

4) It will be added under your classes folder. Now, under your Classes folder, click on SwitchViewsViewController.h to open up the header file.

5. Type this -(IBAction)next:(id)sender;

6) Double click on SwitchViewsViewController.xib

Wednesday, April 6, 2011

Data Protection in iphone 3gs / 4 or iPad

Take security seriously and interested in how to enable data protection on your iPhone, iPod touch, and iPad? The good news is that if you use a passcode, iOS 4 data protections protects the hardware encryption keys on your device, making email, attachments, and 3rd party apps (if they enable it) much more secure. The bad news is, if you updated your iPhone 3GS, iPod touch 3, or original iPad from iOS 3 to iOS 4, data protection might not have been turned on even with the passcode. Not to worry, we’ll walk you through all the possibilities, after the break!

Tuesday, April 5, 2011

Mobile UI Design Tips

  • Consider the font size for people with poorer eyesight.
  • Think about the scaling and sizing of images for different screen sizes and orientations.
  • Analyse colours and their visibility in different lighting conditions and for people with color blindness.
  • Avoid UI bling so the user understands quickly what they are looking at. For example, keep icons simple rather than adding lots of confusing shading.
  • Think about hot spots and content on the UI.
  • Don’t have too many UI designers on the same app. Everyone likes to make their mark on the app and you can end up going around in circles.
  • Don’t over analyse at the start. The end user actually knows best so plan to obtain feedback and iterate. If you really must pre-analyse, have typical end users assess mockups.

Finally think about branding/skinning/white labeling. I have seen so many projects add this late on in the project. It’s far easier to incorporate this from the start rather than add later.

iPhone Data Security

iPhone Data Security
Data security for the iPhone Application should be considered during storage on the iPhone and also during transit over the network.

Data protection during storage.
By default all the data (FDE – Full Disk Encryption) on the iPhone is encrypted using AES encryption algorithm. The key for the same is stored in the iPhone. This feature was introduced in iPhone 3GS and is based on the hardware based encryption. This feature was introduced to enable instantaneous wipeout of the data on the iPhone. By wiping out the key used for the encryption on the iPhone rather than overwriting every bit on the iPhone device, the data on the iPhone was made unusable.

The key used for encrypting the data on the iPhone is not encrypted. There were scenarios where people with knowledge of iPhone and encryption were able to retrieve the key from the iPhone and decrypt all the data on the iPhone (http://www.zdziarski.com/blog/?p=516). This was the weakness with the data encryption using FDE in iPhone 3GS.

With the release of iOS 4 Apple introduced Data Protection feature, a substantial improvement in the security design of iPhone. A combination of the Device Key, User Passcode Key, File System Key and File Key are used to protect the data on the iPhone. This can be called TFA (Two Factor Authentication). TFA is based on ‘what you know’ and ‘what you have’. In case of the Data Protection feature, ‘what you know’ is the User Passcode key and ‘what you have’ are the remaining keys.