Skip to content

Instantly share code, notes, and snippets.

PLIST="${INFOPLIST_FILE}"
PLB=/usr/libexec/PlistBuddy
LAST_NUMBER=$($PLB -c "Print CFBundleVersion" "$PLIST")
NEW_VERSION=$(($LAST_NUMBER + 1))
$PLB -c "Set :CFBundleVersion $NEW_VERSION" "$PLIST"
//
add for extension
$PLB -c "Set :CFBundleVersion $NEW_VERSION" "$SRCROOT/SGSharedExtension/Info.plist"
NSURL *appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://", yourAppScheme]];
NSString *className = @"UIApplication";
if ( NSClassFromString( className ) )
{
id object = [ NSClassFromString( className ) performSelector: @selector( sharedApplication ) ];
[ object performSelector: @selector( openURL: ) withObject:appURL];
}
@shashankpali
shashankpali / Dynamic Predicate
Last active October 13, 2017 12:09
Replace hardcoded value to dynamic value
NSString *contextString = @"userName";
NSString *searchText = @"sh";
NSString *predicateString = [NSString stringWithFormat:@"%@ CONTAINS[c]", contextString];
predicateString = [predicateString stringByAppendingString:@"%@"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateString,searchText];
NSArray *filteredArray = [refArray filteredArrayUsingPredicate:predicate];
OR
Below code crash if searchText = @""
@shashankpali
shashankpali / CocoaPods
Last active August 13, 2016 04:41
Uploading a pod
1. Make sure you have tagged a release version on GitHub.
2. The podspec file must contain the same version as GitHub.
// change git username
3. git config --global user.name MyName --replace-all
// change git email
4. git config --global user.email any@email --replace-all