Skip to content

Instantly share code, notes, and snippets.

@jasonsilberman
jasonsilberman / UILocalNotiication.m
Created March 7, 2014 01:12
Here is my helper function for sending a UILocalNotification, when it gets called while the app is in the background, it does not fire the notification.
- (void)setLocalNotificationForType:(SPKLocalNotificationType)notificationType fromUser:(NSString *)userName withMessageText:(NSString *)msgText {
NSLog(@"setLocalNotificationForType:fromUser:withMessageText:");
if (! useNotifications) { return; }
NSLog(@"setting notif...");
UILocalNotification *notif = [UILocalNotification new];
notif.userInfo = @{@"handle": _convoHandle, @"room": _convoName};
notif.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
<?php
/*
By Marco Arment <me@marco.org>.
This code is released in the public domain.
THERE IS ABSOLUTELY NO WARRANTY.
Usage example:
// In a registration or password-change form: