google

Newest Post

Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

Download Photo Editor by Aviary free of cost with tools and supplies worth $200 till Nov 30,2014

| Saturday, November 15, 2014
Read more »
Download Photo Editor by Aviary free of cost with all tools and supplies till Nov 30,2014

Aviary photo editor has collaborated with Adobe and with latest release on iOS and Android stores, this app is worth $200 including all in app purchases comprising of tools and supplies. All this can be downloaded by configuring the AdobeID, which will provide the access to CreativeCloud service by Adobe.


This offer is available for limited time (till Nov 30,14). Links to download the app 

Google Play Store

iOS



Hack To Access Google Inbox Without An Invite!! Right Here Right Now

| Friday, November 14, 2014
Read more »

Google Inbox


Google Inbox is a new service offered by Google to redefine our gmail (well may be). But this service is available on invitation basis only. Right now one Inbox user can invite max 3 people by sending emails to them.

Following is the video portraying the features in Google inbox ( In case you never heard of) 




Configuring the Google Inbox using an Invite (very simple)
1. Open your email containing the invite, Click on preferred app i.e Android or iOS (tada!!!)
2. If you have already downloaded the "Inbox" app, then it will directly takes you to the Inbox app else it will take you to Play store/App store to download the app.
3. Enjoy Inbox

Configuring the Google Inbox without an Invite (simple enough)
Here is the perfect hack for same.
1. Download the inbox app on your device
2. Find a friend who is trustworthy and has Google Inbox activated on his/her device
3. In their Google Inbox app -> Go to Manage Accounts
4. Ask your friend to add your email account and password to sign in-> Press Done
5. You will receive the Google Inbox welcome email and your account @GoogleInbox is activated
6. Sign-In on your own device in Google Inbox App
7. Delete your account from your friend's device.
8. Enjoy Inbox


In case if you don’t have access to a friend with device and inbox app, you can email at inbox@google.com and request for an invite and get on the waiting list.



Hack To Access Google Inbox Without An Invite!! Right Here Right Now

Posted by : Stranger
Date :Friday, November 14, 2014
With 0comments

Integrating PushSharp In the WCF Restful Web Service to display Push Notifications in Apple, Android and Windows devices

| Monday, September 29, 2014
Read more »
Hello Folks, Today I will demonstrate the method of integrating the PushSharp library in WCF Restful Web Service to send the Push Notifications to Apple, Android and Windows devices.


This library and its documentation is available on the GitHub at following link

Redth/PushSharp


Create a new WCF web service in the Visual Studio(Here I am using Visual Studio 2012). After creating the Web Service, Go to Tools-> NuGet Package Manager -> Manage NuGet Packages for Solution as shown in following image.




In the Package Manager, Search "PushSharp" 


After installing PushSharp NuGet Package, following dlls will be added in the bin folder of the solution. 




Next are the lines of the code which are used to send the notifications from the web service. Please consider following is the minimalist code required to send notifications to devices. For additional functionality, please go through the samples given in the GitHub library of PushSharp.

For Sending Push Notifications to the Android device.

 public void SendAdnoirdPush(string APIKey, string DeviceID, string Message)  
   {  
     var push = new PushBroker();  
     push.RegisterGcmService(new GcmPushChannelSettings(APIKey));  
     push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(DeviceID)  
             .WithJson("{\"alert\":\"" + Message + "\",\"badge\":7,\"sound\":\"sound.caf\"}"));  
   }  

APIKey of the App can be obtained from the Google Developer Console.
DeviceId of the device using the App.
Message to be displayed in the Notification.


For Sending Push Notifications to the iOS device.

 public void SendiOSPush(string DeviceID, string Message, string sound)  
   {  
     var push = new PushBroker();  
     var appleCert = File.ReadAllBytes(new DirectoryInfo(HostingEnvironment.ApplicationPhysicalPath) + "/pushNotificatio.p12");  
     push.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "CertificatePassword"));  
     push.QueueNotification(new AppleNotification()  
                   .ForDeviceToken(DeviceID)  
                   .WithAlert(Message)  
                   .WithBadge(7)  
       .WithSound(sound));  
     //.WithSound("sound.caf")); //default  
   }  

DeviceId of the device using the App.
Message to be displayed in the Notification
sound to be played with Notification

For implementing the iOS Notifications, a signed certificate is required to be generated from the Developer Console. That certificate is copied in the system and Path is given as in the method above. 
Please be careful while mapping the path of the certificate. The certificate is different for sandbox and production
RegisterAppleService requires the certificate password. 

For Sending Push Notifications to the Windows phone.

 public void SendWindowsPhonePush(string ChannelUri, string pageName, string Header, string Message)  
   {  
     var push = new PushBroker();  
     push.RegisterWindowsPhoneService();  
     push.QueueNotification(new WindowsPhoneToastNotification()  
     .ForEndpointUri(new Uri(ChannelUri))  
     .ForOSVersion(WindowsPhoneDeviceOSVersion.Eight)  
     .WithBatchingInterval(BatchingInterval.Immediate)  
     .WithNavigatePath("/" + pageName)  
     .WithText1(Header)  
     .WithText2(Message));  
   }  

ChannelUri is the unique identifier for each device using the App
pageName to navigate to when notification is clicked
Header to be displayed in the Notification Header
Message to be displayed in the Notification Message


and voila!!!! DONE

Above methods can also be combined into one method to send notification to all types of devices., also If notifications are to be sent to multiple devices of same OS, then a "for" loop can be traversed as per the requirement for each method.

Custom UIPickerView for iPhone - displaying multiple columns in the picker view

| Tuesday, December 31, 2013
Read more »
This article demonstrates the custom picker view for iPhone using the UIPickerView class. This application's main view controller contains a button, a label and a picker view control.
  1. Picker view control will have 5 columns which will be added programmatically and each column can contain n number of images. 
  2. Button is used to rotate the images in the columns of the picker view.
  3. Label is used to display result when any 3 consecutive columns have same image value.
Create a new Xcode project using Single View Application template and place the above controls in the view controller. Add picker view delegate, datasource, other actions and outlets for the controls in the header file.

The ViewController.h file should look like this.

@interface ViewController : UIViewController<UIPickerViewDataSource, UIPickerViewDelegate>
{
    
    IBOutlet UIPickerView *pickerView;
    IBOutlet UILabel *lblWinner;
    IBOutlet UIButton *rotateButtonRef;
    
    NSArray *column1;
  NSArray *column2;
  NSArray *column3;
  NSArray *column4;
  NSArray *column5;
    
}

- (IBAction)btnRotate:(id)sender;

@property(nonatomic, retain) UIPickerView *pickerView;
@property(nonatomic, retain) NSArray *column1;
@property(nonatomic, retain) NSArray *column2;
@property(nonatomic, retain) NSArray *column3;
@property(nonatomic, retain) NSArray *column4;
@property(nonatomic, retain) NSArray *column5;
@property(nonatomic, retain) UILabel *lblWinner;
@property(nonatomic, retain) UIButton *rotateButtonRef;


The NSArray declared above will be used to hold the images for each column of the picker view.

Synthesize all the above properties in the implementation file.
@implementation ViewController
@synthesize pickerView,column1,column2,column3,column4,column5, rotateButtonRef,lblWinner;

Add images to the column arrays in the viewDidLoad as follows

UIImage *one = [UIImage imageNamed:@"one.png"];
UIImage *two = [UIImage imageNamed:@"two.png"];
UIImage *three = [UIImage imageNamed:@"three.png"];
UIImage *four = [UIImage imageNamed:@"four.png"];
UIImage *five = [UIImage imageNamed:@"five.png"];
UIImage *six = [UIImage imageNamed:@"six.png"];
UIImage *seven = [UIImage imageNamed:@"seven.png"];
UIImage *ten  = [UIImage imageNamed:@"ten.png"];
    
    
for (int i = 1; i <= 5; i++)
{
UIImageView *oneView = [[UIImageView alloc] initWithImage:one];
UIImageView *twoView = [[UIImageView alloc] initWithImage:two];
UIImageView *threeView = [[UIImageView alloc] initWithImage:three];
UIImageView *fourView = [[UIImageView alloc] initWithImage:four];
UIImageView *fiveView = [[UIImageView alloc] initWithImage:five];
UIImageView *sixView = [[UIImageView alloc] initWithImage:six];
UIImageView *sevenView = [[UIImageView alloc] initWithImage:seven];
UIImageView *tenView = [[UIImageView alloc] initWithImage:ten];
        NSArray *imageViewArray = [[NSArray alloc] initWithObjects: oneView, twoView, threeView, fourView, fiveView, sixView, sevenView, tenView, nil];
NSString *fieldName = [[NSString alloc] initWithFormat:@"column%d", i];
[self setValue:imageViewArray forKey:fieldName];
}
// Seed the random number generator
srandom(time(NULL));

Rotate button action will check for the win-win condition every time its clicked, if condition is true, then win message is displayed otherwise button can be clicked till the condition is true.

- (IBAction)btnRotate:(id)sender {
    BOOL win = NO;
int numInRow = 1;
int lastValue = -1;
for (int i = 0; i < 5; i++)
{
int newValue = random() % [self.column1 count];
if (newValue == lastValue)
numInRow++;
else
numInRow = 1;
lastValue = newValue;
[pickerView selectRow:newValue inComponent:i animated:YES];
[pickerView reloadComponent:i];
if (numInRow >= 3)
win = YES;
}
rotateButtonRef.hidden = YES;
if (win)
[self performSelector:@selector(winMsg) withObject:nil afterDelay:0.5];
else
[self performSelector:@selector(displayButton) withObject:nil afterDelay:0.5];
lblWinner.text = @"";
}


Two methods displayButton , winMsg have been used to handle the display of button and winner message


-(void)displayButton
{
rotateButtonRef.hidden = NO;
}

-(void)winMsg
{
lblWinner.text = @"Bingo!!! you have won!!";
[self performSelector:@selector(showButton) withObject:nil afterDelay:60.0];
}

Implement the picker view delegate methods to display the images in the picker view.

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 5;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [self.column1 count];
}
#pragma mark Picker Delegate Methods

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
if (component == 0)
return [self.column1 objectAtIndex:row];
else if (component == 1)
return [self.column2 objectAtIndex:row];
else if (component == 2)
return [self.column3 objectAtIndex:row];
else if (component == 3)
return [self.column4 objectAtIndex:row];
return [self.column5 objectAtIndex:row];
}

Build and run.

The output should look like this.


























After rotating it could look like this.


























And hence the winner
























Thanks! your feedback is most valuable!


Custom UIPickerView for iPhone - displaying multiple columns in the picker view

Posted by : Stranger
Date :Tuesday, December 31, 2013
With 3comments
Tag :

Introduction to iOS SDK

| Thursday, April 4, 2013
Read more »
The iOS SDK contains the tools and resources to develop native iOS applications, which means that the SDK allows developers to develop, install, run, and test applications in the iOS Simulator and on physical devices.

The two driving forces powering native iOS applications are Objective-C and the native iOS system frameworks.This article includes high level frameworks, such as the UIKit and Map Kit frameworks, but also frameworks that are closely tied to the hardware, such as the Accelerate and Core Location frameworks.

native iOS application
An iOS application is a Cocoa application developed for the iOS platform and a Cocoa application as an application that is
  • Composed of objects that ultimately inherit from NSObject, a root class declared in the Foundation framework.
  • Based upon the Objective-C runtime.
The iOS Architecture



Native applications interact directly with the iOS operating system and the native iOS system frameworks. The operating system acts as a mediator between the application and the underlying hardware. A key advantage of this mediation or abstraction is that native applications don’t need to worry about future hardware changes or device specifications.

The iOS architecture can be broken down into four distinct layers
  1. Cocoa Touch
  2. Media 
  3. Core Services
  4. Core OS 
This layered architecture illustrates that level of abstraction, with the higher level layers more abstracted and the lower level layers more fundamental and closely tied to the hardware. It goes without saying that the higher level layers rely on the lower level layers for some of their functionality.


Cocoa Touch Layer
The Cocoa Touch layer is the topmost layer of the iOS architecture. It contains some of the key frameworks which native iOS applications rely upon, with the most prominent being the UIKit framework. The Cocoa Touch layer defines the basic application infrastructure and provides a number of vital technologies, such as multitasking and touch-based input.

The Cocoa Touch layer provides developers with a large number of high level features, such as auto layout, printing, gesture recognizers, and document support. In addition to the UIKit framework, it contains the Map Kit, Event Kit, and Message UI frameworks, among others.

Media Layer
Graphics, audio, and video are handled by the Media layer. This layer contains a number of key technologies, such as Core Graphics, OpenGL ES and OpenAL, AV Foundation, and Core Media. The Media layer contains a large number of frameworks including the Assets Library framework to access a device’s photos and videos, the Core Image framework for image manipulation through filters, and the Core Graphics framework for 2D drawing.

Core Services layer
The Core Services layer is in charge of managing the fundamental system services that native iOS applications use. The Cocoa Touch layer relies heavily on the Core Services layer for some of its functionality. The Core Services layer also provides a number of indispensable features, such as block objects, Grand Central Dispatch, In-App Purchase, and iCloud Storage.

Core services layer includes ARC(Automatic Reference Counting), Foundation frameworks and Core Foundation framework.

Core OS Layer
Most of the functionality provided by the three higher level layers is built upon the Core OS layer and its low level features. The Core OS layer provides a handful of frameworks that your application can use directly, such as the Accelerate and the Security frameworks. The Core OS layer also encapsulates the kernel environment and low level UNIX interfaces to which your application has no access for obvious security reasons. However, through the libSystem library, which is C-based, many low level features can be accessed directly, such as BSD sockets, POSIX threads, and DNS services.

Introduction to iOS SDK

Posted by : Stranger
Date :Thursday, April 4, 2013
With 0comments
Tag :

JOBS vs RITCHIE

| Monday, April 1, 2013
Read more »




JOBS vs RITCHIE

Posted by : Stranger
Date :Monday, April 1, 2013
With 0comments

Apple iOS development extended to Visual Studio

| Friday, February 22, 2013
Read more »

Apple iOS development extended to Visual Studio

Posted by : Stranger
Date :Friday, February 22, 2013
With 0comments
Tag :

Custom UIPickerView with multiple Columns

| Tuesday, February 19, 2013
Read more »
Display multiple columns in UIPickerView.

Custom UIPickerView with multiple Columns

Custom UIPickerView with multiple Columns

Posted by : Stranger
Date :Tuesday, February 19, 2013
With 1 comments:
Tag :

Adding Custom Code Snippet in XCode

|
Read more »
Following article demonstrates the steps of adding custom code snippets in Xcode
 
Adding Custom Code Snippet in XCode

Adding Custom Code Snippet in XCode

Posted by : Stranger
Date :
With 0comments
Tag :

iOS 6.1 Released: New Features, Improvements, Bug Fixes, Issues, Download Links And Everything You Need To Know

| Wednesday, January 30, 2013
Read more »
Apple rolled out the final version of the iOS 6.1 for iPhone, iPad and iPod touch to the public Monday following Saturday’s release of the fifth and last beta of the latest firmware update. Millions of iOS device owners the world over finally got the much-awaited update almost three months after the first beta of the iOS 6.1 was seeded to registered developers in November last year.

According to Apple, the iOS 6.1 firmware update includes bug fixes, as well as some key features and improvements highlighted below:

- LTE support for more carriers

- Enables purchase of movie tickets through Fandango with Siri (USA only)

- Helps iTunes Match subscribers to download individual songs from iCloud

- New button helps reset the Advertising Identifier

As with iOS 5.1 last year, the iOS 6.1 update seems to be primarily focused on fixing bugs and making incremental improvements.


The easiest way to install the new iOS 6.1 update is over-the-air from Settings, General, Software Update, although the traditional method of updating via iTunes is still available for users who prefer that approach. As with any update, it’s a good idea to make sure you have a recent backup to either iCloud or iTunes—or both—before starting.

Expanded LTE Support

iOS 6.1 improves international LTE carrier support by unlocking LTE capabilities for dozens of additional carriers worldwide, with one very important caveat: you must be using an iPhone 5, iPad mini or fourth-generation iPad. International users of Apple’s first LTE device—the third-generation iPad released last March—will unfortunately still be left out in the cold as both the AT&T and Verizon third-gen iPad models were seemingly built for North American carriers only, and therefore don’t support the LTE frequency bands now used by most carriers outside of North America.

The new LTE carriers of iPhone 5 supported in the firmware update are:
  • USA: Alaska Communications, Alaska GCI, Bluegrass Cellular, C Spire, Cellcom, Pioneer Cellular
  • Canada: MTS, Sasktel
  • Puerto Rico: Claro, Open Mobile
  • Croatia: T-Mobile, VIPNet
  • Denmark: 3, Telenor, Telia
  • Finland: DNA, Elisa, Sonera
  • Greece: Cosmote
  • Hungary: T-Mobile
  • Italy: 3, TIM, Vodafone
  • Kuwait: Zain
  • Luxembourg: Tango
  • Philippines: Globe, SMART
  • Portugal: Optimus, TMN, Vodafone
  • Saudi Arabia: Mobily, Zain
  • South Africa: Vodacom
  • Switzerland: Swisscom
  • UAE: DU, Etisalat

Siri and Fandango

iOS 6.1 users can now purchase movie tickets with some assistance from Siri—a process similar in concept to the restaurant reservations via OpenTable added in iOS 6.0. Users will need to have the Fandango app installed—a voice prompt encourages you to do so if it’s not already there—at which point making a request to purchase movie tickets will basically just hand you off to the Fandango app to complete your purchase.


Note that this Fandango feature is only available in the U.S. at this point. Siri can continue to handle movie lookups as before, but requests to book tickets will result in a message that it can’t do so at any of the available theaters—presumably the same response you’ll get even in the U.S. if no nearby theaters provide online ticket sales via Fandango.

iTunes Match Improvements

iOS 6.1 brings a relatively minor improvement to iTunes Match in the form of the ability to download individual tracks on demand—a feature that was available in iOS 5 but mysteriously disappeared with the release of iOS 6.0.

In iOS 6.1, each individual track now has an iCloud download icon that can be used to fetch the track from the cloud and download it to your local device’s storage. This is essentially the same thing that happens when playing a track from the cloud, but provides users with the ability to pre-download a few tracks without having to fetch an entire playlist—useful when you know you’re going into a place with a poor Internet connection, or if you’re on a limited data plan and are leaving Wi-Fi coverage.



Oddly, however, the Music app in iOS 6.1 treats manually downloaded tracks differently from automatically downloaded tracks—tracks played “from the cloud” are still downloaded as you listen to them in the same way that they have always been, and once played can be replayed without a network connection. However, these tracks retain the iCloud download icon beside them until you manually download them.

iOS 6.1 also brings back the ability to swipe to delete tracks from local storage. Note that this feature only works in the standard track views, not when viewing tracks within a playlist. Swiping left-to-right on an individual track will provide the option to remove that track, and when working from the Albums or Artists listing, you can swipe-to-delete to remove all downloaded content within a specific album or by a specific artist. As in iOS 5, content is only removed from your local device and remains available in your iCloud library.
The iOS 6.1 update also makes another minor change related to the Music app, with the playback controls now rendered with a metallic look, both in the Music app itself as well as on the lock screen.

Passbook Apps

Passbook gets a slight tweak as well: The introductory screen that lets you visit the App Store’s selection of Passbook-enabled software is now its own “pass,” meaning it doesn’t disappear once you add your first digital pass. That way, you can always have access to the App Store collection. (You can, however, delete the pass like any other, if you prefer.)

 

Advertising Identifier

In iOS 6.0, Apple introduced a new Advertising Identifier to replace the use of the unique device identifier (UDID) that many developers and advertisers had previously used to track specific devices for features such as ad targeting. Users were initially given the ability to disable the use of the Advertising Identifier by toggling on the option to “Limit Ad Tracking” hidden under Settings-> General-> About-> Advertising. iOS 6.1 expands this by adding a button that can be used to reset the advertising identifier—a useful feature for those users who may not mind targeted ads but may wish to effectively “start over” with a new unique advertising ID.



It’s actually worth mentioning here that the appearance of these features in iOS 6 is actually an attempt by Apple to increase privacy. Prior to iOS 6, developers were using the UDID—a unique, unchangeable value tied to your specific hardware device—to track advertising. Apple has begun transitioning developers away from using the UDID, and is expected to prevent third-party access to it entirely at some point. Developers will then be required to use the new Advertising Identifier for ad tracking—a setting that users now have the ability to reset on demand or disable entirely.

But What is the Advertising Identifier?
iOS 6 introduces the Advertising Identifier, a non-permanent, non-personal, device identifier, that apps will use to give you more control over advertisers’ ability to use tracking methods. You can reset a device’s Advertising Identifier at any time. And, if you choose to limit ad tracking, apps are not permitted to use the Advertising Identifier to serve you targeted ads. In the future all apps will be required to use the Advertising Identifier. However, until then you may still receive targeted ads.

Apple has also included a variety of security fixes in version 6.1, including for WebKit, Wi-Fi, and other services.

You can download the IPSW, or Apple Device Software Update file for your device from the list of direct links given below:

- iPhone 5 GSM
- iPhone 5 CDMA
- iPhone 4S
- iPhone 4 GSM
- iPhone 4 CDMA
- iPhone 3GS
- iPad mini (GSM, CDMA, Wi-Fi)
- iPad 4th-generation  (GSMCDMAWi-Fi)
- iPad 3rd-generation  (GSMCDMAWi-Fi)
- iPad 2 (GSMCDMAWi-Fi)
- iPad 2 16GB (new)
- iPod touch 4th-generation
- iPod touch 5th-generation

iOS 6.1 Released: New Features, Improvements, Bug Fixes, Issues, Download Links And Everything You Need To Know

Posted by : Stranger
Date :Wednesday, January 30, 2013
With 0comments
Tag :

iOS application with Tab Bar and Navigation Bar for Tabbed navigation as well as Back Forward Navigation.

| Saturday, January 5, 2013
Read more »

For developing an application with tab bar and navigation bar, create a new Xcode project with Tabbed Application Template.

The AppDelegate header file should look like this

@class ViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>


@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) ViewController *viewController;
@property (strong, nonatomic) UITabBarController *tabBarController;

@end

and AppDelegate implementation file will contain the definition of all the view controllers which are to be placed in the Tab Bar of the application and Title of those controllers will be displayed in the Navigation Bar.

The - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method will contain definition and initialization of the view controllers 


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    
    UIViewController *view1, *view2,*view3,*view4,*view5;
    // Override point for customization after application launch.
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        view1 = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
        view2 = [[View2 alloc] initWithNibName:@"View2" bundle:nil];
        view3 = [[View3 alloc] initWithNibName:@"View3" bundle:nil];
        view4 = [[View4 alloc] initWithNibName:@"View4" bundle:nil];
        view5 = [[View5 alloc] initWithNibName:@"View5" bundle:nil];
    } else {
        view1 = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
    }
    UINavigationController *nav1=[[UINavigationController alloc] initWithRootViewController: view1];
    UINavigationController *nav2 =[[UINavigationController alloc] initWithRootViewController: view2];
    UINavigationController *nav3=[[UINavigationController alloc] initWithRootViewController: view3];
    UINavigationController *nav4=[[UINavigationController alloc] initWithRootViewController: view4];
    UINavigationController *nav5=[[UINavigationController alloc] initWithRootViewController: view4];

    self.tabBarController = [[UITabBarController alloc] init];
    self.tabBarController.viewControllers = @[nav1, nav2, nav3, nav4, nav5];
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

The above code holds the key for displaying the view controllers with Navigation bar. Please import header files of all above controllers in the AppDelegate.

If we add controllers directly into the self.tabBarController.viewControllers then all the controllers will open without the Navigation Bar.

In the each view controllers' initWithNibName set the title and image to be displayed with the Tab.

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = NSLocalizedString(@"View 1", @"View 1");
        self.tabBarItem.image = [UIImage imageNamed:@"star"];
    }
    return self;
}

Add star named image in the project.

To open a new view controller with Back navigation on the Navigation Bar along with the Tab Bar at the bottom, Open the new view controller on a button touch up inside or any other action as follows.


 ViewController1 *view1 = [[ViewController1 alloc] initWithNibName:@"ViewController1" bundle:nil];
  [self.navigationController pushViewController: view1 animated:YES];


And you have the app ready with Tabbed Navigation at the bottom and Navigation Bar at the top.

Build and run the project.

The App will look something like this.

























Please provide your feedback!! Thanks.






iOS application with Tab Bar and Navigation Bar for Tabbed navigation as well as Back Forward Navigation.

Posted by : Stranger
Date :Saturday, January 5, 2013
With 2comments
Tag :

Facebook SDK 3.1 integration with iOS 6.0

| Friday, December 28, 2012
Read more »

The Facebook SDK for iOS is designed to be easy to install and use. Following are the steps which can be followed to integrate Facebook SDK in iOS 6.0

  1. Prerequisites
    • Install Latest version of Xcode or at least Xcode 4.5
    • Install Facebook SDK for iOS 6. The default install location is "Documents/FacebookSDK"
  2. SDK includes an Xcode project which contains sample code for separate modules linked with Facebook SDK.
  3. To run an app with Facebook, We need to mention Facebook App Id, for that a new Facebook App needs to be created using Facebook personal/developer account.
  4. Create an Xcode project to implement Facebook SDK.
  5. Add frameworks "FacebookSDK","Accounts","AdSupport" and "Social" into the frameworks section (using build phases -> link libraries) of Test App Xcode project which we created in Step 4.
  6. Add "libsqlite3.dylib" library also in the frameworks section from the build phases -> link libraries.
  7. Add the FacebookAppId, which we created on Facebook website, in the Xcode App plist file as follows



















  • Start Coding!!


  • Facebook Login Setup

    The Facebook SDK for iOS will automatically choose the best option when you attempt to use Facebook login, i.e either through the Facebook App on iPhone or opening the mobile Facebook in the Safari browser.

    1. Set up an Xcode project, here we created a single view application project named "FacebookTest".

    2. In AppDelegate.h (whatever name in your project), Add code to include Facebook SDK






    3. Add a button in the View Controller to initiate the login flow. Wire this button to an action named authButtonAction in header file of View Controller.

        - (IBAction)authButtonAction:(id)sender;

    4. In AppDelegate.h define a global variable for Facebook notification and action definition to initiate a session.

    extern NSString *const FBSessionStateChangedNotification;

    - (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI; 

    5. In AppDelegate.m, define the notification string

    NSString *const FBSessionStateChangedNotification = @"com.example.Login:FBSessionStateChangedNotification";

    6. Also add the 3 methods in AppDelegate.m file

    /*
     * Callback for session changes.
     */
    - (void)sessionStateChanged:(FBSession *)session
                          state:(FBSessionState) state
                          error:(NSError *)error
    {
        switch (state) {
            case FBSessionStateOpen:
                if (!error) {
                    // We have a valid session
                    NSLog(@"User session found");
                }
                break;
            case FBSessionStateClosed:
            case FBSessionStateClosedLoginFailed:
                [FBSession.activeSession closeAndClearTokenInformation];
                break;
            default:
                break;
        }
        
        [[NSNotificationCenter defaultCenter]
         postNotificationName:FBSessionStateChangedNotification
         object:session];
        
        if (error) {
            UIAlertView *alertView = [[UIAlertView alloc]
                                      initWithTitle:@"Error"
                                      message:error.localizedDescription
                                      delegate:nil
                                      cancelButtonTitle:@"OK"
                                      otherButtonTitles:nil];
            [alertView show];
        }
    }

    /*
     * Opens a Facebook session and optionally shows the login UX.
     */
    - (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
        NSArray *permissions = [[NSArray alloc] initWithObjects:
                                @"email",
                                @"user_likes",
                                nil];
        return [FBSession openActiveSessionWithReadPermissions:permissions
                                                  allowLoginUI:allowLoginUI
                                             completionHandler:^(FBSession *session,
                                                                 FBSessionState state,
                                                                 NSError *error) {
                                                 [self sessionStateChanged:session
                                                                     state:state
                                                                     error:error];
                                             }];
    }

    /*
     * If we have a valid session at the time of openURL call, we handle
     * Facebook transitions by passing the url argument to handleOpenURL
     */
    - (BOOL)application:(UIApplication *)application
                openURL:(NSURL *)url
      sourceApplication:(NSString *)sourceApplication
             annotation:(id)annotation {
        // attempt to extract a token from the url
        return [FBSession.activeSession handleOpenURL:url];
    }

    The first method called openSessionWithAllowLoginUI: is invoked when the login button is clicked or when a check is made for an active session when the main view is initially loaded. This method calls the openActiveSessionWithReadPermissions:allowLoginUI:completionHandler: method of FBSession class to open a Facebook session. 

    The second method called sessionStateChanged: defines the completion handler. 

    @"email",
    @"user_likes",

    gives additional permissions for email and user likes.

    application:openURL:sourceApplication:annotation: delegate method calls the Facebook session object:

    7. handleDidBecomeActive: handles the call to the active session of Facebook. Call this method in AppDelegate.m file's  applicationDidBecomeActive method. 

    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        // We need to properly handle activation of the application with regards to Facebook Login
        // (e.g., returning from iOS 6.0 Login Dialog or from fast app switching).
        [FBSession.activeSession handleDidBecomeActive];
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    8. Call close method of FBSession class to close the current active Facebook session when App (FacebookTest) is about to terminate. 

    - (void)applicationWillTerminate:(UIApplication *)application
    {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
        [FBSession.activeSession close];

    } 

    9. Include AppDelegate.h in the ViewController implementation file.

    10. Call the openSessionWithAllowLoginUI in the authButtonAction action

    - (IBAction)authButtonAction:(id)sender {
        AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
        // The user has initiated a login, so call the openSession method
        // and show the login UX if necessary.
        [appDelegate openSessionWithAllowLoginUI:YES];
    }


    Build and run the project, If everything is added correctly the App should run in the simulator. If not please 
    1. check the required frameworks have been added properly or not
    2. check FacebookAppId is added in plist and Id does exist.

    Facebook SDK 3.1 integration with iOS 6.0

    Posted by : Stranger
    Date :Friday, December 28, 2012
    With 2comments
    Tag : ,
    Prev
    ▲Top▲