How to Create Local Notifications in iOS App

 - (void) setupLocalNotification:(NSString*)dateString {
   
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    
    [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EEST"]];
    
    [formatter setDateFormat:@"yyyy-MM-dd HH mm"];
    
    NSDate *itemDate = [formatter dateFromString: dateString];
    
    if ([itemDate compare:[NSDate dateWithTimeIntervalSinceNow:0.1]] == NSOrderedAscending) {
        return;
    }
    
    
    UILocalNotification *localNotif = [[UILocalNotification alloc] init];
    localNotif.fireDate = itemDate;
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
    
    
    localNotif.alertBody = @"Alert message";
// Set the action button
    localNotif.alertAction = @"View";
    
    localNotif.soundName = UILocalNotificationDefaultSoundName;
    localNotif.applicationIconBadgeNumber = 0;
    

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
}

Check iOS Version


You can get the OS version using: 
NString *systemVersion = [[UIDevice currentDevice] systemVersion];

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)

#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

Usage : 

    if (SYSTEM_VERSION_LESS_THAN(@"5.0")) {

        

    }
    else {
        
    }


source: stackoverflow.com

How to cancel a local git commit

(loosing changes, like checking out previous commit) 
 
git reset --hard HEAD~1
 
 
(will not lose changes, only cancels commit) 
git reset --soft HEAD~1

Starting Phone Calls From iPhone App

To start phone call from iPhone app, create url with phone link and open that url via ..sharedApplication] openURL: ... method.


    NSURL *phoneUrl = [NSURL URLWithString:@"tel:1-408-555-5555"];
    
    if ([[UIApplication sharedApplication] canOpenURL:phoneUrl])
        [[UIApplication sharedApplication] openURL:phoneUrl];


Apple document about phone links:
https://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html

Basic Git Commands

Some Useful Git Commands

Create local git repository
git init

Add all files to git
git add .

Remove remove file from git (this command doesnt delete your file from disk)
git rm --cached <file path>

Make your first commit
git commit -a -m "<commit message>"

Changing latest commit message
git commit --amend -m "<commit message>"

Setup your remote repo
git remote add <remote name> <remote url>

Push local resources to remote repo
git push -u <remote name> <branch name>

Remove remote:
git remote rm <remote name>

Clone remote repository
git clone <url>


List branches
git branch

Create branch
git branch <branch name>

Switch branch
git checkout <branch name>

Create and switch that branch
git checkout -b <branch name>

Delete branch
git branch -d <branch name>

Delete remote branch
git push <remote name> :<branch name>
Rename branch
git branch -m <old branch name> <new bracnh name>

Add tag
git tag -a v1.0 -m <description message>

Push tag
git push <remote name> <tag name>

Push all tags
git push <remote name> --tags

Delete tag
git tag -d <tag name>

Delete remote tag
git push <remote name> :refs/tags/<tag name>