Skip to content

Instantly share code, notes, and snippets.

View Aquima's full-sized avatar
:octocat:
Development on iOS

RAUL QUISPE Aquima

:octocat:
Development on iOS
View GitHub Profile
import Foundation
import CoreData
/// NSPersistentStoreCoordinator extension
extension NSPersistentStoreCoordinator {
/// NSPersistentStoreCoordinator error types
public enum CoordinatorError: Error {
/// .momd file not found
case modelFileNotFound
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString* deviceTokens = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"name.plist"];
NSArray *plistData = [NSArray arrayWithContentsOfFile:finalPath];
@Aquima
Aquima / NSURLSession
Created October 28, 2013 20:01
Ejemplo de como usar NSURLSession
#import "WSConsult.h"
@interface WSConsult()<NSURLSessionDelegate>
@end
@implementation WSConsult
+(WSConsult *)sharedInstance {
static dispatch_once_t pred;
static WSConsult *shared = nil;
dispatch_once(&pred, ^{