Friday, December 23, 2011

Monday, November 28, 2011

How to convert PDF files to ePub files to read on your iPad with iBooks

This tutorial will guide you through the process of converting PDF files so that they can be read in iBooks, the iPad application.


Update: you can now read PDF files directly in iBooks, without having to convert them to .epub or any other format. See this tutorial for a quick overview of how to add PDF files to iBooks to read on your iPad, iPhone or iPod Touch.
This tutorial will remain up just in case someone wants to create an .epub of their PDF.
iBooks uses an ebook format called ePub. Using a free converter application (and ebook manager) called calibre you can quickly convert PDF (and other file formats) to .epub files, which you can then transfer to your iPad for reading in iBooks. This tutorial will take you step by step through the entire process.

Monday, November 21, 2011

How to Create an Iphone App Layout in Photoshop


Step 1:Setting up the Workspace

Okay! First step is to set up the workspace.Open Photoshop (For your help, I`m using Adobe Photoshop CS5) and create a new canvas of 1300×950 px.
setting up the workspace How to Create an Iphone App Layout in Photoshop
The layout will be 840px wide.Now, draw 2 vertical guides at 230px and 1070px to delimit the layout,like in the image.

Tuesday, November 15, 2011

UINavigationController Customization Tutorial


Creating a UINavigationController programmatically

Creating a UINavigationController programmatically is trivial. Assuming that you’ve already created a class called RootViewController that subclasses UIViewController, you would use something like this, typically in your AppDelegate file:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

// rootViewController can't be an instance of UITabBarController
// remember to include RootViewController in your class!
RootViewController * rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];

[self.window addSubview:navigationController.view];

// Don't bother releasing navigationController as it needs to be around all the time

   [self.window makeKeyAndVisible];

   return YES;
}

Wednesday, November 9, 2011

Xcode 4 : Select and Edit All Variables in Scope


The Jump Bar is the navigation area at the top of the source editor pane, which is highlighted in red in the figure below:


Xcode 4 : Select and Edit All Variables in Scope


Xcode offers a nice way to highlight all references of a variable within the current scope. First, make sure you have the setting shown below enabled within the Text Editing tab in the Xcode Preferences:

Get Started Guide for iOS using Phonegap


  • 1. Requirements

    • Intel-based computer with Mac OS X Snow Leopard (10.6)
    Necessary for Installing on Device:
    • An Apple iOS device (iPhone, iPad, iPod Touch)
    • iOS developer certification
  • 2. Install SDK + PhoneGap

    Download and install Xcode from Apple Developer Portal (Membership required)

    Download the latest copy of PhoneGap and extract its contents. Navigate to the iOS directory and run the installer until completion.
  • Thursday, November 3, 2011

    Read some interesting data from your iDevice with iOS 4.3



    Ever tried to read some interesting data like the Serial Number, IMEI, Phone Number… from your iPhone (or an other iDevice) ? Some data is easy to access, some other uses not supported API calls. I have written a simple App which can read the above mentioned data. You can download it here (click)

    Monday, October 17, 2011

    iPhone: Locating the serial number, IMEI, ICCID, or MEID


    Getting the information using your iPhone

    If you have access to your iPhone, here are some quick ways to obtain your iPhone serial number, International Mobile Equipment Identity (IMEI), ICCID, or Mobile Equipment Identfier (MEID).

    iPhone About screen

    You can find your iPhone serial number, IMEI, ICCID, or MEID in the About screen on your iPhone. From the Home screen, tap Settings > General > About and scroll down.

    Apple support and service


    Contacting Apple for support and service

    International Technical Support Numbers

    To expedite your call, please have your hardware serial number ready. Learn how to find your serial number.

    Monday, October 10, 2011

    60 QUOTES BY STEVE JOBS

    60 QUOTES BY STEVE JOBS



    “Sometimes when you innovate, you make mistakes. It is best to admit them quickly, and get on with improving your other innovations.”

    “Being the richest man in the cemetery doesn’t matter to me … Going to bed at night saying we’ve done something wonderful… that’s what matters to me.”

    Steve Jobs next to Adam,Newton With Apple





    Siri. Your wish is its command.

    Siri on iPhone 4S lets you use your voice to send messages, schedule meetings, place phone calls, and more. Ask Siri to do things just by talking the way you talk. Siri understands what you say, knows what you mean, and even talks back. Siri is so easy to use and does so much, you’ll keep finding more and more ways to use it.

    Reminders in iOS5




    Reminders

    A better way to do to-dos.

    Next time you think to yourself, “Don’t forget to...,” just pull out your iPhone, iPad, or iPod touch and jot it down. Reminders lets you organize your life in to-do lists — complete with due dates and locations. Say you need to remember to pick up milk during your next grocery trip. Since Reminders can be location based, you’ll get an alert as soon as you pull into the supermarket parking lot. Reminders also works with iCal, Outlook, and iCloud, so changes you make update automatically on all your devices and calendars.

    Newsstand in iOS5




    Newsstand

    A custom newsstand for all your subscriptions.

    Read all about it. All in one place. iOS 5 organizes your magazine and newspaper app subscriptions in Newsstand: a folder that lets you access your favorite publications quickly and easily. There’s also a new place on the App Store just for newspaper and magazine subscriptions. And you can get to it straight from Newsstand. New purchases go directly to your Newsstand folder. Then, as new issues become available, Newsstand automatically updates them in the background — complete with the latest covers. It’s kind of like having the paper delivered to your front door. Only better.

    Notification center in iOS5





    Notification Center


    All your alerts. All in one place.


    You get all kinds of notifications on your iOS device: new email, texts, friend requests, and more. With Notification Center, you can keep track of them all in one convenient location. Just swipe down from the top of any screen to enter Notification Center. Choose which notifications you want to see. Even see a stock ticker and the current weather. New notifications appear briefly at the top of your screen, without interrupting what you’re doing. And the Lock screen displays notifications so you can act on them with just a swipe. Notification Center is the best way to stay on top of your life’s breaking news.

    Features of iOS5 in safari



    Safari




    Even better site-seeing.

    iOS 5 brings even more web-browsing features to iPhone, iPad, and iPod touch. Safari Reader displays web articles sans ads or clutter so you can read without distractions. Reading List lets you save interesting articles to peruse later, while iCloud keeps your list updated across all your devices. On iPad, tabbed browsing helps you keep track of multiple web pages and switch between them with ease. And iOS 5 improves Safari performance on all your iOS devices

    Monday, September 26, 2011

    The J2ME record management system


       The J2ME record management system (RMS) provides a mechanism through which MIDlets can persistently store data and retrieve it later. In a record-oriented approach, J2ME RMS comprises multiple record stores. An overview of J2ME RMS and MIDlet interfacing is given in Figure 1.

    Figure 1. Overview of J2ME RMS and MIDlet interfacing
    Overview of J2ME RMS and MIDlet interfacing

    Tuesday, September 20, 2011

    App Store Tip


    HTTP Live Streaming in iOS


    HTTP Live Streaming is a streaming standard proposed by Apple. See draft 5.
    Files involved are
    • .m4a for audio (if you want a stream of audio only).
    • .ts for video. This is a MPEG-2 transport, usually with a h.264/AAC payload. It contains 10 seconds of video and it is created by splitting your original video file, or by converting live video.
    • .m3u8 for the playlist. This is a UTF-8 version of the WinAmp format.

    Wednesday, August 31, 2011

    Xcode and #pragma mark


    #pragma mark directives in code to help with organization as implementation files grow.
    #pragma mark is simple to use,

    for example, insert the following to call out initialization code:
    #pragma mark -
    #pragma mark Initialization

    Tuesday, August 9, 2011

    How to Play Video in iPhoneOS4


    Step 1: Create a View base application using template. Give the application name “VideoPlayiPhoneOS4”.

    Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

    Friday, July 29, 2011

    ICloud APIs



    iCloud storage APIs allow IOS application developers to store documents and other data to a central location so users can view or edit from any device without having to sync or transfer files.

    How to renew iPhone development certificate

    First, in the iPhone provisioning Portal, you'll see that your certificate is expired:


    The only available option is to request for a new certificate. You hit Request certificate.

    Tuesday, July 26, 2011

    Implement UIWebView With a Transparent background in iPhone


    Step 1: Create a Window base application using template. Give the name of the application “WebView”.
    Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

    Step 3: We need to add the resource file called as “Background.png” into the resource folder. Select resources and add files existing sources and select theBackground.png.
    Step 4: Now we’ll add view controller class to the project. Choose New file -> Select cocoa touch classes group and then select UIViewController subclass. Give the name WebViewController.
    Step 5: We create a WebView.html from where the data will be display.

    Customize UISlider color


    Instead of having 3 UISlider with 3 UILabels telling red, green, blue, we have 3 UISlider with custom colors. Everybody would agree that this is nicer…
    To do this, just customize your UISlider this way :
    [redSlider setMinimumTrackImage:[[UIImage imageNamed:@"redSlider.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0] forState:UIControlStateNormal];
    Then you just need the images. Taken (and edited) from the UICatalog Apple Template :

    Thursday, July 14, 2011

    How to Prevent iPhone from Sleeping

    The automatic sleep timer is one of the ways the iPhone saves power. If the screen isn’t touched for a certain amount of time, it dims the screen and eventually turns it off. Although you should leave the timer on, there are times when this is not what you want (games are a good example).
    To disable the timer, set the idleTimerDisabled property to YES,


    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];

    Date Formatter Examples

    NSDateFormatter

    To save you some time, here are several simple examples for displaying date information:

    // <strong>Output ->  Date: 10/29/08</strong>
     NSDate *today = [NSDate dateWithTimeIntervalSinceNow:0];
     NSDateFormatter *dateFormat = [[[NSDateFormatter alloc] init] autorelease];
     [dateFormat setDateStyle:NSDateFormatterShortStyle];
     NSString *dateString = [dateFormat stringFromDate:today];
     NSLog(@"Date: %@", dateString);
     

    How to “unfreeze” your iPhone Application

    To avoid “freezing” your application, ensure that any logic that is changing your UI is performed by the Main thread. One approach to this would be to leverage the NSNotificationCenter but sometimes that is overkill. A much simpler approach is to use one of the following performSelectorOnMainThread methods on NSObject:
    performSelectorOnMainThread:withObject:waitUntilDone: 
    performSelectorOnMainThread:withObject:waitUntilDone:modes:

    CGRect, CGSize and CGPoint

    Digging into development of iPhone applications, you’ll eventually encounter references to CGRect, CGSize, and CGPoint. These references are to C structures (see this post for more information on structures). This post will provide a high-level view of what comprises CGRect and its counterparts. Here is how CGRect is defined:

    Rename an Xcode Project

    Renaming an Xcode Project
    First, click on the Project menu and select Rename:




    From there, fill in the new name, I’d also recommend creating a snapshot as a precaution:




    Renaming an Xcode project is no longer a mysterious, troublesome endeavor.

    Capture iPhone Simulator Screenshots – Revisited – iPhone Simulator Cropper

    iPhone-Simulator Cropper
    This tool works by capturing the screen of the simulator runnning on your system. One really slick feature is the option to create captured images in two primary formats – first, a format suitable for upload to iTunes for your application screenshots – second, capturing a screenshot that is suitable for display on a website.

    How to Prevent Your Application from Being Placed into the Background

    By default, when running on a device that supports multitasking, if the user quits the application (pressing the Home button), the application will be notified and moved to the background. This is nice as the response time when the user requests the application again is generally very quick, not to mention the application resumes in the same place/state as when it exited.
    Even with this built-in convenience, they are times when this default behavior may not be ideal. For example, depending on the application, it may require a fair amount of additional development time to properly manage this state change. In such cases, simply quiting the application may be preferred.

    Get UDID from iTunes

    The following tips runs you through the steps to quickly look up the UDID number for a device from with iTunes.
    Begin by plugging in the device and starting iTunes. Choose your device in the DEVICES section on the left side of iTunes. At this point you should see the iPhone stats (name, capacity, software version, etc) similar to the figure below. By default the serial number will be shown on the second line from the bottom:




    If you click the Serial Number, the content of that row will change to show the UDID:

    The Google+ project: Huddle

    A New Android Market for Phones

    Adding Text Message to an ActionSheet

    The ActionSheet supports one line of text, the title, which as the name implies, is displayed across the top of the Alert. See the image below for an example.


    Wednesday, July 13, 2011

    Xcode 4 has semantic issue

    The version is 4.0.2. I think I found where the problem is.

    The simple code is:

    1.png 


    when I add header search path recursively:
    1.png 

    then the "Semantic Issure" will occur:

    1.png 


    Otherwise, the issue will disappear!

    So, the recursively search of header path's will cause this "Semantic Issue".

    iPhone Splash Screen Tutorial

    Creating a Splash Page

    We will be adding a splash page that will fade out into our main game screen.  Start by downloading this image and adding it to your project’s Resources Folder. Make sure you check the box to copy this image to the project’s directory.
    splash iPhone Tutorial for Creating a Splash Screen

    Friday, July 8, 2011

    Creating Static Libraries For iOS

    What’s a static library

    In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable. This executable and the process of compiling it are both known as a static build of the program. Historically, libraries could only be static.
    On the iPhone, static libraries have a .a extention and can only contain code. This means that any resources (xibs, images, etc…) must be packed either in a bundle or shipped separately than the library. We won’t go into this part today.

    Wednesday, July 6, 2011

    iPhone Programming Tutorial – Local Notifications


    iChat: How to Change Your Displayed Name or Bonjour name

    To change your displayed name or Bonjour messaging name, edit your Address Book card.

    Note: Following these steps changes your Address Book card for all places that you use it, not just iChat. 1. Quit iChat if it is open.
    2. Open Address Book.
    3. Choose Card > Show My Card.
    4. Click the Edit button.
    5. Edit your first and last name.
    6. Save changes by clicking the Edit button again or by selecting a different card.
    7. Open iChat. Your revised name appears after you log in.

    Friday, July 1, 2011

    Apple Patents Improve iPhone Security With Biometrics

    In a hint of things to come, more patents submitted by Apple just a few months ago show advances in future security designs for iPhones and notebook computers. The new authentication methods include several biometric technologies that would verify the identity of a user without any additional input from the owner of the device.

    apple iphone patent security fingerprint biometric

    Examples would use cameras and software for facial recognition or allow a touch screen to identify a fingerprint. These methods could authenticate a user and protect private information without the current delay required when entering a passcode.

    Apple has also envisioned systems that would identify a user based on retinal patterns, the shape of their ears, or the sound of the user's voice. Other methods described in the patent application would have the user touch a sequence of shapes or gesture on the device in a particular pattern to unlock.

    Although it sounds far-fetched, with further advances in mobile hardware even Apple's suggestion that DNA could be analyzed to authenticate may not be too far off.

    Wednesday, June 22, 2011

    iOS 4 iPad Camera and UIImagePickerController Application (Xcode 4)

    An Overview of the Application

    The application user interface for this example will consist of an image view and a toolbar containing two buttons. When selected by the user, the first button will display the camera to the user and allow a photograph to be taken and subsequently displayed in the image view. The second button will provide access to the camera roll where the user may select an existing photo image. In the case of a new image taken with the camera, this will be saved to the camera roll.

    Since we will be covering the playback of video in the next chapter (Video Playback from within an iOS 4 iPad Application) the camera roll and camera will be restricted to still images in this example. The addition of video support to this application is left as an exercise for the reader at the end of the next chapter.
    Creating the Camera Project

    Tuesday, June 14, 2011

    Android: Switching screens in an Activity with animations (using ViewFlipper)

    how to switch between layers using animations to make it look like you are changing screens… we will be using a ViewFlipper widget in the layout XML.

    1. Create a new Android project, unless you already have one

    01 new project

    2. Create a new Activity class that extends android.app.Activity.

    Android: How to switch between Activities

    create an Activity, and to switch to another Activity (think of it as another screen) on the click of a button.

    1. Create a new Android project – or you might already have one created.

    01 new project

    2. Add a new Class that extends android.app.Activity. You need a total of two classes that extend Activity. You will switch from one Activity to another.

    ExpandableListView on Android

    ListView is pretty widely used. There are situations when you would like to group/categorize your list items. To achieve such a thing on Android, you would probably use the ExpandableListView. The data to the ExpandableListView is supplied by a special kind of adapter called the SimpleExpandableListAdapter which extends the BaseExpandableListAdapter.

    Monday, June 13, 2011

    How to add CoverFlow Effect on your iPhone App


    The main criteria of this post is to help you add a cool effect called the “cover flow/open flow” effect to any of your iphone apps. This is cool in two ways actually. One it adds animation kind of effect to your app and the other, its very easy to build too.

    I got to learn about this effect when I was working on my “pianos” app where in i’ll have bunch of animals to select which would be displayed as a menu using this “cover flow” effect. Once a particular animal is selected your piano view for that animal comes up. My piano app will be out soon and you can check that out. The source for this post is the link displayed below.

    “http://fajkowski.com/blog/2009/08/02/openflow-a-coverflow-api-replacement-for-the-iphone/”

    Based on his post I have simplified things further. He uses “flicker API” for the images in his “cover flow”  but in my version I would just use my own library of images so that this post would target the beginners. To begin with we should work with Photoshop a bit to generate your images. If your not acquainted with photoshop, never mind not a problem at all. This particular task with the photoshop just wants you to scale the  images you use in your library to size “225 * 225″ applying “Free Transformation”. That’s all what you got to do. Once you got your images then your ready to go.


    Creating the project

    Firstly Create a new “view based”  project with project name like “CoverFlow”.

    Once you create a new project you would arrive at a screen shown below with predefined classes already generated for you.

    Screen shot 2010-04-07 at 4.05.07 PM

    Android - Add data to SQLite database, with SimpleCursorAdapter updated dynamically

    Work on the article "A simple example using Android's SQLite database, exposes data from Cursor to a ListView", it was modified to add ui for user to add data to SQLite database. Once SQLite database updated, simple call cursor.requery() to update ListView dynamically.

    Add data to SQLite database, with SimpleCursorAdapter updated dynamically

    Android: Reading, using and working with XML data and web services in Android

    One of the most powerful aspects of any mobile application for a 3G phone is that it can connect to the Internet. By connecting to the Internet the application can offer much more value to the user since it becomes an interface for a web-based component, e.g. using Twitter’s API to create a Twitter application so that you can get your Twitter updates without having to open the mobile browser. The most common way of interfacing with a web-based component is by using web services in XML format.

    While trying to developer my own app which reads a web service from my own server, I ran into a lot of difficulties in implementing the client that consumes the web service. Android does not have libraries for XPath handling of XML documents, so it makes deciphering XML data a little bit more difficult. From what I’ve read online the Android team is currently working on including such libraries in future versions.

    After some digging around I found an amazing link that shows different methods for consuming an XML file in Android and parsing through it without the use of XPaths. The link is this: Working with XML on Android. To start off, this link is an absolute must-read. Everything that I am going to write in my post here relates to this link. The code offered on that webpage uses polymorphism to show you 4 different methods of working with XML data. It provides a fully-functional Android application and all the source code for it. The source code can be found here: AndroidXML.zip.

    My post today will concentrate on how to customize the code from the application in the above link, in order to read and parse your own XML data. If you are a Java pro, you might not need this post. My Java is a little rusty, so I needed some time to figure out exactly what I had to change and where in order to get this to work with my own web service XML. Now that I’ve figured it out, I thought I’d share it. In my next post I will give the simplified version of this code – where there is no polymorphism, and thus there are only the minimum number of classes needed to implement this XML-reading solution.

    Friday, June 10, 2011

    How to read the assets directory resources - Andriod


    1. Get the input stream resource


    Resource file sample.txt at $ PROJECT_HOME / assets / directory, can be adopted in the Activity

    Context.getAssets (). Open ("sample.txt")

    Method to obtain input stream.

    Note: If the resource file is a text file that you need to consider file encoding and line breaks. Recommend the use of UTF-8 and Unix line breaks.

    2. WebView load the assets directory html files


    Resource file sample.html at $ PROJECT_HOME / assets / directory, the following code can be

    WebView.loadUrl ("file: / / / android_asset / sample.html");

    Load html file.

    Wednesday, June 8, 2011

    A first hand look at building an Android application

    Adding a UIButton Programatically

    You might know how to add a button via IB – here is a code sample of how to do that using code

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchDown];
    [btn setTitle:@"SKIP" forState:UIControlStateNormal];
    btn.frame = CGRectMake(0, 100, 320, 50);
    [self.view addSubview:btn];

    and if you want to add a background image


    UIImage *someImage = [UIImage imageNamed:@"splashImage.png"];
    [btn setBackgroundImage:someImage forState:UIControlStateNormal];

    Adding a UIButton Programatically

    You might know how to add a button via IB – here is a code sample of how to do that using code

    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchDown];
    [btn setTitle:@"SKIP" forState:UIControlStateNormal];
    btn.frame = CGRectMake(0, 100, 320, 50);
    [self.view addSubview:btn];

    and if you want to add a background image


    UIImage *someImage = [UIImage imageNamed:@"splashImage.png"];
    [btn setBackgroundImage:someImage forState:UIControlStateNormal];

    Difference between 2 UIDatePicker’s in hours

    UIDatePicker *date1;
    UIDatePicker *date2;

    The function to show difference between these two date pickers


    NSDate *date1Val = date1.date;
    NSDate *date2Val = date2.date;
    NSTimeInterval interval = [date2Val timeIntervalSinceDate:date1Val];
    int hours = (int)interval / 3600;
    int minutes = (interval - (hours*3600)) / 60;
    NSString *timeDiff = [NSString stringWithFormat:@"%d:%d", hours, minutes];

    Hacking into PhoneGap iPhone/iPad Apps

    Initially a lot of web-developers started with PhoneGap which lets you make webpages and embed them inside an iPhone app.

    Now similarly its very easy to get access to those web pages. Let me show you how.
    Steps:
    Get hold of an phonegap iPhone App. I have one, which I had created a long time back.
    - So go to – http://www.phonegap.com/apps
    - Select iPhone or iPad
    - Pick an app for which you want code (Let me pick my application)

    iPhone/iPad AirPrinting Tutorial in 3 steps

    Step 1:

    Start Xcode and make a New Project – Select View-based Application – I call it AirPrinting.

    Thursday, June 2, 2011

    Mac Terminal Error : Could not determine audit condition

    When I launched my terminal today, was welcomed with this error :-

    login: PAM Error (line 396): System error
    login: Could not determine audit condition

    [Process completed]

    It is most probably because I was playing with my /usr/bin permissions the other day.
    The fix is easy. Just delete the "/usr/bin/login" dir.

    But how do I delete it, if I can't access the "Terminal" altogether ?
    Come on - You can access any folder using the "Finder".

    1. Open "Finder"
    2. Open "Go To Folder"
    3. Type "/usr/bin/login"
    4. Delete it.

    Monday, May 30, 2011

    How To Stop iTunes Automatically Syncing Your iPhone, iPod or iPad

    iTunes Auto Sync Slowing You Down?

    If you’re wondering how you can stop iTunes from automatically kicking off the sync + backup + update process when you plug your iOS device in then look no further.

    By holding down the Shift + Control keys (Windows) or Command + Option keys (Mac) and then plugging your iPad, iPhone or iPod into your USB port you will tell iTunes not to sync!

    If you happen to miss it and sync kicks off anyway, either slide the unlock slider on your device or hit the eject symbol in iTunes and your device will gracefully stop syncing and disconnect.

    This was tested using both an iPad 2 and an iPhone 3GS on iTunes 10.2 (Mac).

    Wednesday, May 25, 2011

    iOS - File Sharing



    File Sharing requires

    • The latest version of iTunes
    • Mac OS X v10.5.8 or later or an up-to-date version of Windows XP, Windows Vista, or Windows 7
    • An iOS device (with the latest version of iOS)
    • An iOS application that supports File Sharing

    How to copy files using File Sharing

    1. Connect your iOS device to your computer using the included Dock Connector to USB cable.
    2. Launch iTunes 9.1 or later on your computer.
    3. Select your iOS device from the Devices section of iTunes.

      iTunes Devices section
    4. Click the Apps tab and scroll down to the bottom of the page.

    How to Find Your iPhone’s Unique Identifier (UDID)


    What is the UDID?


    Each iPhone or iPod Touch has a Unique Device Identifier (UDID),
    which is a sequence of 40 letters and numbers that is specific to your
    device. It’s like a serial number but much harder to guess. It
    will look something like this:
    2b6f0cc904d137be2e1730235f5664094b831186.


    Why do we need the UDID?


    Your iPhone can only install programs that are approved by Apple.
    Applications in the App Store have been approved by Apple for general
    distribution, but beta customers get to try the app before it’s in the
    store. We register your UDID with Apple so they can approve our
    application especially for your iPhone.


    How do I get my UDID?


    You can copy/paste your UDID from iTunes or email it directly from
    your device by using a free app from the App Store.

    Tuesday, May 24, 2011

    MTOM - OVER VIEW

    MTOM OVERVIEW

    With web services-based SOA now being deployed across Global 2000
    enterprises, transmitting attachments such as MRI Scans, X-Rays, Design
    Documents and Business Contracts using SOAP messages has become a
    common practice. SOAP Message Transmission Optimization Mechanism (MTOM),
    is a W3C Recommendation designed for optimizing the electronic
    transmission of attachments. Through electronic transmission of
    documents, corporations can realize significant cost savings and better
    service levels by eliminating the use of postal mail. Paper-based
    manual tasks can be replaced with simple and efficient electronic
    processes where binary data can be transmitted between organizations
    through standards such as MTOM.

    MTOM provides an elegant mechanism of efficiently transmitting
    binary data, such as images, PDF files, MS Word documents, between
    systems. The Figure below shows the steps involved in transmitting data
    between a Consumer and Producer using MTOM.



    MTOM Process

    The Consumer application begins by sending a SOAP Message that contains complex data in Base64Binary encoded format. Base64Binary data type represents arbitrary data (e.g., Images, PDF files, Word
    Docs) in 65 textual characters that can be displayed as part of a SOAP
    Message element. For the Send SOAP Message Step 1 in the Figure above, a sample SOAP Body with Base64Binary encoded element <tns:data> is as follows:

    Monday, May 23, 2011

    Understanding MTOM

    MTOM combines the composability of Base 64 encoding with the transport efficiency of SOAP with Attachments. Non-XML data is processed just as it is with SOAP with Attachments SWA – the data is simply streamed as binary data in one of the MIME message parts. (The MTOM processing model is described in greater detail below.)

    MTOM is composed of three distinct specifications:

    Monday, May 16, 2011

    How to Get the RGB Color Code from hex code

    - (UIColor *) RGBColorCodeWithHCode: (NSString *) Hexcode{
    NSString *colorstr = [[Hexcode stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    // String should be 6 or 8 characters
    if ([colorstr length] < 6)
    return [UIColor blackColor];
    // strip 0X if it appears
    if ([colorstr hasPrefix:@"0X"])
    colorstr = [colorstr substringFromIndex:2];
    if ([colorstr length] != 6)
    return [UIColor blackColor];
    // Separate into r, g, b substrings
    NSRange range;
    range.location = 0;
    range.length = 2;
    NSString *rcolorString = [colorstr substringWithRange:range];
    range.location = 2;
    NSString *gcolorString = [colorstr substringWithRange:range];
    range.location = 4;
    NSString *bcolorString = [colorstr substringWithRange:range];
    // Scan values
    unsigned int red, green, blue;
    [[NSScanner scannerWithString: rcolorString] scanHexInt:&red];
    [[NSScanner scannerWithString: gcolorString] scanHexInt:&green];
    [[NSScanner scannerWithString: bcolorString] scanHexInt:&blue];

    return [UIColor colorWithRed:((float) red / 255.0f)
    green:((float) green / 255.0f)
    blue:((float) blue / 255.0f)
    alpha:1.0f];
    }

    Wednesday, May 11, 2011

    iPad Modal View Controllers

    Modal view controllers are well documented in the View Controller Programming Guide for iPhone OS but here is a quick recap of how to present and dismiss a modal view. To keep things simple I will cover the steps for presenting the modal view when a button is pressed on a master view controller. When the button is pressed we need to create and show a detail view controller that contains a button that the user can use to dismiss the modal view controller. The NIB file for the detail view controller is trivial in this example consisting of just a single view containing a text label.

    Allocating and showing the detail view controller is straightforward:

    - (void)buttonAction:(id)sender {
    // Create the modal view controller
    DetailViewController *viewController = [[DetailViewController alloc]
    initWithNibName:@”DetailViewController” bundle:nil];
    // We are the delegate responsible for dismissing the modal view
    viewController.delegate = self;
    // Create a Navigation controller
    UINavigationController *navController = [[UINavigationController alloc]
    initWithRootViewController:viewController];
    // show the navigation controller modally
    [self presentModalViewController:navController animated:YES];
    // Clean up resources
    [navController release];
    [viewController release];
    }


    Tuesday, May 10, 2011

    iPhone-iPad Development Tips

    1. Screen Resolution;

    iPhones are available in different screen resolutions; It is in 320×480 and the iPhone 4 screen resolution is 640×960. Same in caes of iPad; Currently it is 1024×768 and iPad 2 likely to have 2048×1536 screen resolution; So we need to care about this while playing with layouts; Here is a code to determine screen size;

    CGRect currentScreen = [[UIScreen mainScreen] bounds];
    currentScreen.size.width will return the width of screen;
    currentScreen.size.height will return height of screen;

    Note: If you rotate your screen to landscape, then height will become width and vise versa;

    2. Device Type;

    Following piece of code will tell you whether your application is running on iPhone or iPad;

    UIDevice* currentDevice = [UIDevice currentDevice];
    if(currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
    NSLog(@"oh its iPad");
    }else{
    NSLog(@"This is iPhone");
    }

    Friday, May 6, 2011

    iOS - Architecture


    Cocoa Touch Layer - features

    Multitasking

    Applications built using iOS SDK 4.0 or later (and running in iOS 4.0 and later) are not terminated when the user presses the Home button; instead, they shift to a background execution context. The multitasking support defined by UIKit helps your application transition to and from the background state smoothly.
    To preserve battery life, most applications are suspended by the system shortly after entering the background. A suspended application remains in memory but does not execute any code. This behavior allows an application to resume quickly when it is relaunched without consuming battery power in the meantime. However, applications may be allowed to continue running in the background for the following reasons:
    • An application can request a finite amount of time to complete some important task.
    • An application can declare itself as supporting specific services that require regular background execution time.
    • An application can use local notifications to generate user alerts at designated times, whether or not the application is running.
    Regardless of whether your application is suspended or continues running in the background, supporting multitasking does require additional work on your part. The system notifies your application as it transitions to and from the background. These notification points are your cue to perform any important application tasks such as saving user data.

    Thursday, May 5, 2011

    Reading and Writing plists

    Reading a plist file from the application bundle just requires a few lines of code, and some error handling. I like to place that code in a nice convenience method like this:
     

    - (id)readPlist:(NSString *)fileName {
       NSData *plistData;
       NSString *error;
       NSPropertyListFormat format;
       id plist;

       NSString *localizedPath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"plist"];
       plistData = [NSData dataWithContentsOfFile:localizedPath];
       plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];
       if (!plist) {
          NSLog(@"Error reading plist from file '%s', error = '%s'", [localizedPath UTF8String], [error UTF8String]);
          [error release];
       }

       return plist;
    }

    I’m not too fond of using id as return values or parameters to methods. I prefer stronger type checks, so I typically wrap the readPlist method in two methods that return either an array or a dictionary.

    Creating a New Navigation-Based Application

    Open Up Xcode



    You will be doing all of your development in Xcode. Then close the Welcome window (if it shows up)
    Start a new iPhone OS Project
    Click Xcode > New Project and a window should pop up like this:



    Make sure Application is selected under iPhone OS and then select Navigation-Based Application. Click Choose… It will ask you to name your project.  Type in “Hello World” and let’s get started.

    iPhone Programming Tutorial – UITableView Hello World

    In this tutorial I will walk to you through creating a simple “Hello World” application using a UITableView for the iPhone.  There are many ways that a Hello World program could be made on the iPhone, I am going to show you the simplest.  This tutorial assumes you have a basic understanding of Objective-C.  Apple has provided a very simple and straight forward tutorial on Objective-C.  You can find it here.
    You will learn how to:
    This tutorial assumes that you have already installed the iPhone SDK.  If you are unsure how to do this, click and follow the steps.

    Debugging Tutorial – Automating Your Tests With A UIRecorder Instrument

    If you have ever experienced a bug in your application that took many steps to reproduce, then this tutorial is for you.  By nature, testing and debugging are very tedious processes.  This is especially the case for the iPhone.
    Say you have an app that drills down 5-levels deep to some other view.  Now let’s say that you have a bug on that view 5 levels deep.  Your normal method of debugging is:
    • Run the app
    • Tap view 1
    • Tap view 2
    • Tap view 3
    • Tap view 4
    • Tap view 5
    • (Crash)
    • Change some code
    • Repeat
    As you can see (and I’m sure have noticed), this sucks.  Well, Kendall Gelner gave a killer talk at 360iDev (which I recently attended) on various debugging tips using Instruments and XCode.  One of the most useful techniques (to me) was how to automate your testing.  Let me show you what I mean.

    1. Open up the app you wish to test/debug
    2. Launch it in the simulator
    3. Open Instruments – This is located in /Developer/Applications/Instruments (just do a spotlight search for it)

    simple Navigationbased tutorial

    It’s time to start displaying some drinks. You’ll need to make some modifications to both the RootViewController.h and RootViewController.m files

    1Declare the drinks array.(in RootViewController.h )

    @interface RootViewController : UITableViewController{
    NSMutableArray* drinks;
    }
    @property (nonatomic, retain) NSMutableArray* drinks;
    @end
    (RootViewController.m)

    @synthesize drinks;
    -(void)dealloc{
    
    [drinks release];
    
    [super dealloc];
    
    }

    Backup iPhone Pictures – Mac Tips

    Listen to this episode
    When you have problems with your iPhone, you may have no other choice than to RESTORE it back to the factory state. Before you restore, iTunes says it is making a backup of your phone. However, it isn’t making a backup of any photos you have taken with it. So when the phone is restored, all of your photos will be gone. The good news is that If you have your iPhone set to sync your photos with iPhoto automatically when you plug it in, you may be OK. However, if you are like me and choose for the iPhone not to launch iPhoto when you connect it… well, you need to backup those pics.

    How to do it:

    1. Plug-in your iPhone and launch iPhoto. iPhoto will detect your iPhone, and you can now choose to import all or import selected pictures.
    mactips_358_1.png
    Doing this will add pictures you have taken with your iPhone into your iPhoto library.

    Another Way – Image Capture

    You can also use Image Captureimagecapture.png to do the same thing, but not add them to your iPhoto library.
    1. Plug-in your iPhone. Launch Image Capture. You can find it in your Applications folder. If you don’t see it there, look in the Utilities folder. Note: On the podcast, I said it will be in the utilities folder… I forgot that it may reside in Applications.
    2. Now it will detect your iPhone, and you can choose to Download Some or Download ALL to your Mac.
    mactips_358_2.png