Tuesday, 18 June 2013

Implementing Admob onto your iOS App

Usually iAd is used as the advertisement portal for including ads on your iOS apps. But iAd is not supported in all countries and Google's admob has a wide range of network.

Here are some simple steps to follow in Xcode to include admob ads on your app.

1. Considering that you have already created your app, you need to add few lines of code and header files onto your controller.h file of the app.

  •  #import <UIKit/UIKit.h>
    #import "GADBannerView.h"

    @interface ViewController : UIViewController{
         GADBannerView *bannerView_;
    }

    @end


2. Few App Frameworks are to be added to app. They are required to make the ad work.

  • Under Build Phases>Link Binary with Libraries>add the following frameworks.
  • AudioToolbox.Framework
  • CodeGraphics.Framework
  • SystemConfigurateion.Framework
  • MessageUI.Framework


3.You need to integrate the admob's SDK for iOS onto you app bundle. This is done by adding a New Group to the app

  • Right click your app name > New Group > name it 'Admob'.
  • Click File>Add Files (with the group name highlighted) > Navigate to location of SDK.
  • Now the SDK files are linked onto your app.

3. The code to be added to your main program

- (void)viewDidLoad
{
    [super viewDidLoad];
    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
    
    // Specify the ad's "unit identifier". This is your AdMob Publisher ID.
    bannerView_.adUnitID = @"YOUR UNIQUE ID";
    
    // Let the runtime know which UIViewController to restore after taking
    // the user wherever the ad goes and add it to the view hierarchy.
    bannerView_.rootViewController = self;
    [self.view addSubview:bannerView_];
    
    // Initiate a generic request to load it with an ad.
    [bannerView_ loadRequest:[GADRequest request]];

// Do any additional setup after loading the view, typically from a nib.
}


4. You need to be a registered member of Admob to get a valid ID for every ad you make, for every App. It has to be activated in the website to be executed in the app.

Once the above steps have been followed successfully, the ad will we displayed as preferred :)

Thursday, 13 June 2013

Deployment of Apps (Mac)

It's comparatively easy to use a Mac to develop iOS Apps.

Things you will need:
1. A Mac with OSx installed in it.
2. Xcode.
3. iOS latest library files.
4. iOS developer certificate.

Step I: If you have a Mac with OSx installed in it go ahead and download Xcode from the App Store, it's absolutely free of cost and is quiet a large App therefore it may take time.


Step II: Once you have Xcode installed, open it and choose the properties of your App i.e. Orientation Type, iOS version, distribution type and so on, al these and more asked when you give File>New Project.





Step III: You need sound knowledge of Objective C to code your apps, the hierarchy and file structure of the App gets arranged by default towards the left side of your window on the mac and your good to go to code your App.

Step IV : Once you'v created the app you can use the simulator to test it by building your app on Xcode itself.

Step V: Once you have finalised your App, you use your certificate to generate the .ipa file. (Note : You NEED the certificate to develop the .ipa file so as to deploy it in a real device. It costs 99$ per year and can be purchased at www.developer.apple.com)

Step VI: Once you have the file generated, you can sync it using iTunes on to your idevice.


Wednesday, 12 June 2013

Deployment of Apps (Windows)

Most people think that u DEFINITELY need a MAC to develop an iOS app (be it for the iPhone, iPad or itouch) but the truth is there are ways to get going with windows.

Though I'm totally against it, I was desperate to create an app for the idevice i had (itouch 4g) and at that time i did not own a MAC.

I googled around and found bits and pieces of how to do it on windows and here are the steps to successfully deploy an app on an idevice (obviously jailbroken idevice) using Flash CS5 on Windows.

Step I: Download Flash CS5 for Windows, get it installed.


Step II: Convert your apple developer certificate into a .p12 certificate so that it gets accepted by adobe CS5 (http://help.adobe.com/en_US/as3/iphone/WS144092a96ffef7cc-371badff126abc17b1f-7fff.html).

Step III: Use action script to do your coding for your app.
Note: Make sure to increase object code to move stuff around on a screen instead of moving them using frames because frames would make the app large in size.

Step IV: Use the .p12 certificate in the flash cs5's properties by browsing to it's location and generate the .ipa file once you'v designed your app. (it's easy following on screen instructions but if u need any help do ask)

Step IV: Getting the app into the idevice is a little tricky; you will need
(i) Cydia
(ii)ifile.

(i) If you have jailbroken your device, go to Cydia download app sync for your version of iOS (e.g.: AppSync 4.2.*) and transfer the app onto the device using ifile.
Once you have done the above two tasks, sync the app by browsing to it and by using app Sync.
The other way of doing it which is illegal is syncing it using iTunes (cause your app was not registered officially at the app store).

Either way the app gets deployed and you can test yo development apps.

Next Blog Deployment using MAC :)