小编Jes*_*ado的帖子

保留多个用户(NSUserDefaults,XML文件或数据库)首选项的最佳方法

我正在创建一个iOS应用程序,可以管理用户并登录它们.

我想保留每个用户的用户数据设置,但我不确定每个用户保存此设置的最佳方法是什么.

我应该将数据保存到xml文件,还是NSUserDefaults,甚至将它们保存到我的Parse Cloud数据库中?

我只想在加载视图时保存用户属性列表,但我必须考虑到我的应用程序必须为当前用户加载正确的参数.

例如:

用户:Peter trackingSwitchEnabled:是的

用户:Molly trackingSwitchEnabled:没有

用户:Paul trackingSwitchEnabled:是的

objective-c ios

5
推荐指数
1
解决办法
2630
查看次数

在Xcode 5中导出行为首选项?

有没有办法在Xcode 5中导出我的自定义行为首选项以与其他Mac共享?

我的自定义行为设置

xcode

4
推荐指数
1
解决办法
699
查看次数

从通知中心删除Observer的最佳位置在哪里

我认为应该在这里:

-(void) viewWillDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];

    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
    [nc removeObserver:self];

}
Run Code Online (Sandbox Code Playgroud)

或者也许在-dealloc.

这两个听起来都很奇怪所以我不完全确定它.

首先,在我的AppDelegate中,我通过Parse收听远程通知

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];

    NSString * urlToGo = [userInfo objectForKey:@"url"];
    NSLog (@"Recibo notificación con paremetro url: %@", urlToGo);


    NSNotification *note = [NSNotification
                            notificationWithName:PUSH_NOTIFICATION
                            object:self
                            userInfo:userInfo];

    [[NSNotificationCenter defaultCenter] postNotification:note];

}
Run Code Online (Sandbox Code Playgroud)

在myViewController中 - (void)viewDidLoad {[super viewDidLoad];

    _lastMenuSelected=menu1;

    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
    [center addObserverForName:PUSH_NOTIFICATION
                        object:nil
                         queue:mainQueue
                    usingBlock:^(NSNotification *note) {

                     // Save in property to …
Run Code Online (Sandbox Code Playgroud)

objective-c nsnotificationcenter ios

2
推荐指数
1
解决办法
807
查看次数

标签 统计

ios ×2

objective-c ×2

nsnotificationcenter ×1

xcode ×1