Posts

Communication between iPhone & Watch OS2

In this tutorial we will cover communication between iPhone and Watch using WatchConnectivity framework (available for Watch OS2 & onwards) 1. Create a Single View Application (you can use other application type too). 2. Click File -> New Target -> WatchKit App (Do not choose WatchKit App for watchOS 1 as it does not support WatchConnectivity framework). 3. So we do have two Targets viz. App and App Watch Extension. 4. Import the WatchConnectivity framework to both the targets. 5. In our App's ViewController.h file #import <WatchConnectivity/WatchConnectivity.h> add protocol <WCSessionDelegate> 6. Now in our App's ViewController.h file's viewDidLoad method: check if WCSession is supported by our iOS, if yes then do initailize WCSession, set its delegate and activate the session as shown: if ([ WCSession isSupported ]) {         WCSession *session = [ WCSession defaultSession ];         session. del...

payUmoney Payment Gateway Integration in iOS App (Objective C)

Image
We have many Payment Gateways available such as Paypal , CCAvenue , Zaakpay , etc. payUmoney is the best Payment Gateway available in India now; according to me. I am saying this with my personal experience with  payUmoney  Technical Support Team. They offer 2.9% Transaction charges without any Enrolment, Setup, AMC or other Hidden charges. payUmoney Home Page Link:  Home_Page payUmoney Contact Details:  Address:   5th Floor, Pearl Towers Plot 51, Sector 32 Gurgaon, 122002  Phone:   0124-6624956,  0124-6624970  Email:   techsupport@payumoney.com Steps to integrate payUmoney gateway: 1. Create a new iOS Objective C app in XCode. 2. Open Main.storyboard in you app. 3. Add UIWebView and set its Delegate. [Screenshot 1] 4. Set Frames & Constraints as per design requirements. 5. Link UIWebView by creating IBOutlet to either .h or .m file. [Screenshot 2] 6. Signup ...

Variable declaration in Swift

Declaration of iVar: Let's start with declaring iVars in Swift In Swift we can declare an iVar using keyword: 1. let - it declares an immutable iVar 2. var - it declares a mutable iVar let myLetObject = "My immutable iVar" So now i cannot change the value of myLetObject after it is once assigned. var myVarObject = "My mutable iVar" myVarObject = "Changed the value of iVar" I can change its value at any instance. Some examples of declaring objects: let luckyNumber = 9 let  myAge = NSInteger (27 ) var myHeight = 5.5 let myImage = UIIMage(named:"MyPhoto.png") var myName: NSString = NSString"string:Suraj Ramjan Mirajkar" var tableView: UITableView !

Youtube Video Player

To play Youtube video within the app we have 2 ways: 1. Open Youtube App (if installed) or launch Safari to play video: [[ UIApplication sharedApplication ] openURL :[ NSURL URLWithString : @"http://www.youtube.com/watch?v=Xk1zfQOklJY" ]]; In this case we don't have a choice to bring back the user to our app. So we better use the 2nd way. 2. Embed Youtube iOS Player Helper: I have used  youtube-ios-player-helper  Version -  0.1.3 Select  YTPlayerView.h ,  YTPlayerView.m , and the  Assets  folder from my Github repository  CODE . Drag these files and folders into your project. Make sure the  Copy items into destination group’s folder  option is checked. When dragging the Assets folder, make sure that the  Create Folder References for any added folders  option is checked. Drag a UIView the desired size of your player onto your Storyboard. Change the UIView's class in the Identity Inspector tab to Y...

Check Internet Connectivity Using AFNetworking 2.0

I have created  NetworkRechabilityMonitor class to get the Internet Connection status in my app using AFNetworking 2.0 library. 1. Create an NSObject class naming  NetworkRechabilityMonitor , add below code in respective Header & Implementation files.   NetworkRechabilityMonitor.h #import <Foundation/Foundation.h> @interface NetworkRechabilityMonitor : NSObject +( void )startNetworkReachabilityMonitoring; +( BOOL )checkNetworkStatus; @end NetworkRechabilityMonitor.m #import "NetworkRechabilityMonitor.h" @implementation NetworkRechabilityMonitor #pragma mark - Start Monitoring Network Manager +( void )startNetworkReachabilityMonitoring {     [[ AFNetworkReachabilityManager sharedManager ] startMonitoring ]; } #pragma mark - Check Internet Network Status +( BOOL )checkNetworkStatus {     return [ AFNetworkReachabilityManager sharedManager ]. reachable ; } ...

iOS 6 Grouped Style UITableView in iOS 8 App

I came across a requirement where i have to show  iOS 6 grouped style UITableView in iOS8 App. So i did some workaround and it really works. Steps: I added a UITableView on UIViewController (Scene) in UIStoryboard. I reduced the width of the UITableView and centre aligned it (eg. UIViewController width - 320px so i take 300px UITableView). Add & Import QuartzCore framework. In cellForRowAtIndexPath method make the cell layer corner round as per requirement and set masktobounds as shown below. - ( UITableViewCell *)tableView:( UITableView *)tableView cellForRowAtIndexPath:( NSIndexPath *)indexPath {     static NSString *CellIdentifier = @"TableCell" ;          UITableViewCell *tableCell = [tableView dequeueReusableCellWithIdentifier :CellIdentifier];     if (tableCell == nil ) {         tableCell = [[ UITableViewCell alloc ] initWithStyle : UITableViewCel...

Text to Speech in iOS7

iOS7 makes Text to Speech really easy and that also in multiple languages. iOS7 has added two new classes for Text to Speech functionality: 1. AVSpeechSynthesizer 2. AVSpeechUtterance First Link AVFoundation and AudioToolbox Framework from Application Target -> Build Phases -> Link Binary With Libraries. Import both frameworks in Header file (.h file) #import <AVFoundation/AVFoundation.h> #import <AudioToolbox/AudioToolbox.h> add delegate <AVSpeechSynthesizerDelegate> . In implementation file (.m file)     AVSpeechSynthesizer *speechSynthesizer = [[AVSpeechSynthesizer alloc] init];     AVSpeechUtterance *speechUtterance = [AVSpeechUtterance speechUtteranceWithString:@"Welcome to iOS App."];      speechUtterance .rate = AVSpeechUtteranceMaximumSpeechRate / 4.0f;      speechUtterance .voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; // language     [ speechSynthesi...