小编Nik*_*Loy的帖子

崩溃[NSKeyedArchiver archivedDataWithRootObject:self.data]

我有这个方法崩溃[NSKeyedArchiver archivedDataWithRootObject:self.data]:

- (void) synchronize
{
    @synchronized (self.data)
    {
        NSData *encryptedData = [[NSKeyedArchiver archivedDataWithRootObject:self.data] NL_AES256EncryptWithKey:userKey]; //La ça crash
        BOOL success = [NSKeyedArchiver archiveRootObject:encryptedData toFile:[self filename]];

        if (!success)
        {
            // we lost some data :(
            NSLog(@"Failed to synchronize to file %@", [self filename]);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是对对象方法(getter/setter)的所有访问都受到保护,@synchronized(self.data)并且此属性是私有的.

任何的想法?

编辑:崩溃日志是明确的:

*** Collection <__NSArrayM: 0x1756a800> was mutated while being enumerated.

0   CoreFoundation  0x2e95becb __exceptionPreprocess + 131
1   libobjc.A.dylib 0x390f2ce7 objc_exception_throw + 39
2   CoreFoundation  0x2e95b9b9 -[NSException name] + …
Run Code Online (Sandbox Code Playgroud)

multithreading locking objective-c ios

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

iOS自定义按钮未显示交互式通知

我目前正在研究由8制作的交互式iOS通知,老实说,我真的很难看到我的按钮.使用下面的代码,我看不到我的按钮:

// INTERACIVE

UIMutableUserNotificationAction *acceptAction =
[[UIMutableUserNotificationAction alloc] init];

acceptAction.identifier = @"ACCEPT_IDENTIFIER";
acceptAction.title = @"Accept";
acceptAction.activationMode = UIUserNotificationActivationModeBackground;
acceptAction.destructive = NO;
acceptAction.authenticationRequired = NO;

UIMutableUserNotificationAction *maybeAction =
[[UIMutableUserNotificationAction alloc] init];

maybeAction.identifier = @"MAYBE_IDENTIFIER";
maybeAction.title = @"Maybe";
maybeAction.activationMode = UIUserNotificationActivationModeBackground;
maybeAction.destructive = NO;
maybeAction.authenticationRequired = YES;


UIMutableUserNotificationAction *declineAction =
[[UIMutableUserNotificationAction alloc] init];

declineAction.identifier = @"DECLINE_IDENTIFIER";
declineAction.title = @"Decline";
declineAction.activationMode = UIUserNotificationActivationModeBackground;
declineAction.destructive = YES;
declineAction.authenticationRequired = NO;


UIMutableUserNotificationCategory *inviteCategory =
[[UIMutableUserNotificationCategory alloc] init];

inviteCategory.identifier = @"INVITE_CATEGORY";

[inviteCategory setActions:@[acceptAction, maybeAction, declineAction]
                forContext:UIUserNotificationActionContextDefault]; …
Run Code Online (Sandbox Code Playgroud)

ios uilocalnotification ios8

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