Friday, January 18, 2013

Integration of File Sharing from your App to iTunes

Hey guyz, in this section i will be explaining about how we can share app's files which are stored in its document directory  via itunes, say, accessing app's document directory. For example, lets say some app named "testApp" stores bunch of files in its documents folder which are downloaded from web, now we may want to see those files in our desktop. So for file sharing, iOS 4 & later have a great new feature called File Sharing that provides a convenient way for users to transfer files between their computer and your app.

Its really a simple step and it goes like this.......
- To enable File Sharing in your app, you simply set the boolean flag UIFileSharingEnabled in your info.plist. Or , some of you may find Application supports iTunes file sharing flag in your info.plist. Just set flag to YES.


After that, iTunes will display anything you save to the Documents directory in your app to the user, when they go to the “Apps” page in iTunes like this :
Note : One thing, you must keep in your mind is that only the files that are stored in your app's documents directory can be seen and shared!!! For storing files in documents directory, please have a look at :  Handling NSDocumentDirectory of iOS App

That's all from Xcode side, Now for more details on  File sharing features : http://support.apple.com/kb/HT4094#

Thursday, January 17, 2013

Checking Internet Connection in iOS Apps

In this section, i will be describing about how we can check internet connectivity in iOS apps. For this kind of task, Apple has provided a very helpful sample reachability class . So, we will be using that class to make it working on our apps. First , grab the reachability sample code from: http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

Now, you don't have to ho through all the codes in sample app, just follow these few steps to check internet connection in our app :

  1. Add the SystemConfiguration.framework to your project.
  2. Add the files Reachability.h and Reachability.m only from the Reachability sample code you just downloaded to your project.
  3. Add the following code in the implementation file where you need to test the Internet connection.    

Thursday, December 20, 2012

Having problem on creating .ipa file from Xcode's "Product -> Archive" or "Build & Archive" method ?

                 Creating an IPA is done in a simple way from your Xcode : Product -> Archive (previously Build & Archive). After the Archive operation completes, go to the Organizer, select your archive, select Share and in the "Select the content and options for sharing:" pane set Contents to "iOS App Store Package (.ipa) and Identity to iPhone Distribution (which should match your ad hoc/app store provisioning profile for the project).
It's a simple stuff to do but BANggggg... You might be in trouble if you have been using some other static library, third party library, other xcode project files in your project. You might have following issue that disables your .ipa file selection :
 “No Packager exists for the type of archive and This kind of archive cannot be signed."

Wednesday, December 19, 2012

Opening iOS Apps from Browser or any other source using URL Scheme in iOS Devices

In this section, i will be describing about how to open up an app in iOS device either from a Browser or from any other application present in iOS devices.

First thing you need to do is to register a URL scheme  in to device which is done in your app's info.plist file. URL Scheme will be your key to open up your app from browser or any other app. Here are the step by step procedure :
First open up your info.plist
Step 1. Right-Click and “Add Row”
screen-capture.png

Wednesday, October 3, 2012

"Pull Down To Refresh" integration for updating data in UITableViews

Hello Guyz , in this section we will be talking about "Pull Down To Refresh" integration for updating your data in UITableView. This kind of effect can be seen in  facebook app, where we  pull down the view and it refreshes/updates the facebook feeds. In the similar way, in this section i will write a bunch of codes that basically do is: when we pull down the UITableView, it will updates its datasource and reload the table section. Here, is the example screen that will help you to understand about this effect more wisely.
download and add this dropdown image to be used in project named updateArrow.png

Tuesday, October 2, 2012

Rate/Review apps in iTuneStore from inside iOS application

Hello Guyz, in this section i will describe you, how we can write a review or rate an app in iTuneStore from inside iOS Application by writing few lines of code. The example i am showing here will directly open up the iTuneStore review section of your app  in your device (to be noted is that the bunch of code i am writing here will only work on actual device.)

-(IBAction) rateAndReviewInItuneStore:(id)sender{
 NSString* url = [NSString stringWithFormat: @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%@",AppID];
     [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url ]];

}
Here, AppID = your Apple ID in your iTuneStore , can be found inside your app  in iTuneStore and under "App Infromation" section of your app (9 digit numbers).

"Follow us on Twitter" button integration in iOS Application

Hello Guyz, In this section i will show you the two different way to integrate "Follow us on Twitter" button from inside our iOS App. If you are a twitter user then you probably got what i am talking about. "Follow us" button is very popular in web apps, by integrating it we can directly follow some people or organization depending on the twitter screen name we choose to follow and in this section i will show you how we can integrate it from inside our iOS apps.

Method 1: Without using any API
 Without plugging into native twitter app or  using any other API in code, we could simple open a URL to do the job of Following some one in twitter.
-(IBAction)FollowUsOnTwitter:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://twitter.com/intent/user?screen_name=%@",TwitterAccountName]]];
}
Note : TwitterAccountName = your twitter account name you wish to follow, and it will open to follow that account in the browser.

Method 2: Using Twitter Framework for iOS 5 and later
  To be noted here is that Twitter framework is available  only for  iOS 5 and later version.
- First of all , add "Twitter.framework" and "Accounts.framework" to your project.
- now include #import <Accounts/Accounts.h> and #import <Twitter/Twitter.h> to your .h file.