Tag: logging

魔法logging添加对象,不同的上下文错误

我在我的应用程序中使用魔法logging,并希望添加用户的function,添加一个“注”,这是“入门”的孩子。 我添加了这个代码: [MagicalRecord saveWithBlock: ^(NSManagedObjectContext *localContext) { Note *newNote = [Note MR_createInContext: localContext]; newNote.content = noteContent; newNote.name = @"User Note"; [self.entry addNotesObject: newNote]; } completion: ^(BOOL success, NSError *error) { if (error != nil) { // show alert } else if (success) { [[self tableView] reloadData]; } }]; 我一直在最后一行得到的错误是“非法尝试在不同的上下文中的对象之间build立关系”条目“ 我尝试将'entry'和'newNote'的上下文设置为'localContext',但是我仍然得到相同的错误。 我错过了什么?

如何使用MagicalRecord设置Core Data轻量级迁移?

我尝试使用MagicalRecord来设置Core Data的轻量级迁移。 我已经使用Google和SO查看了关于这个主题的所有post。 我了解persistentStoreCoordinator是如何工作的,以及我想要做的设置。 这是我的代码: AppDeligate.h NSPersistentStoreCoordinator *persistentStoreCoordinator; AppDelegate.m – (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator != nil) { return persistentStoreCoordinator; } NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"saori.sqlite"]]; // handle db upgrade NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; NSError *error = nil; persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: […]

MR_SHORTHAND不起作用

我使用MagicalRecords,但由于某种原因MR_SHORTHAND不适合我。 我已经将这些行添加到Prefix.pch #define MR_SHORTHAND #import "CoreData+MagicalRecord.h" 在应用程序调用+ createEntity方法的情况下,应用程序因无法识别的select器而终止。 但是,如果我写MR_createEntity一切工作正常。 Team *team = [Team MR_createEntity]; // This line works 但 Team *team = [Team createEntity]; // This line does not work with reason: '+[Team createEntity]: unrecognized selector sent to class 0x74b8c'

NSFetchedResultsController调用didChangeObject删除而不是更新

这是代码,我通过魔法logging保存模型: MagicalRecord.saveWithBlock({ (localContext) -> Void in var localNotification = CDNotification.MR_findFirstByAttribute("notificationID", withValue: notification.notificationID, inContext: localContext) as CDNotification localNotification.readNumber = NSNumber(bool: true) }) 上面的代码被调用后,删除被调用而不是更新: func controller(controller: NSFetchedResultsController, didChangeObject object: AnyObject, atIndexPath indexPath: NSIndexPath, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath) { switch type { case NSFetchedResultsChangeType.Insert: self.tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade) case NSFetchedResultsChangeType.Update: if let cell = self.tableView.cellForRowAtIndexPath(indexPath){ self.configureCell(cell as TableViewCell, […]

请求用户在iPhone上崩溃后发送崩溃日志

有些应用程序询问用户是否想在崩溃后重新启动时通过电子邮件发送崩溃日志。 他们是怎么做到的? 他们必须logging崩溃时的日志,并读取这个文件,并要求用户发送它,如果它不是空的? 有没有一个框架或一个开放源码的项目,我可以整合做到这一点?

禁用MagicalRecord错误消息和警告

我刚开始使用MagicalRecord,这可能是一个愚蠢的问题,但它真的困扰着我…我使用MagiteRecord与SQLite,当我启动MagicalRecord,我用 [MagicalRecord setupCoreDataStackWithStoreNamed:@"OrderSystem.sqlite"]; 并产生了以下消息: 2012-10-16 16:54:48.966 OrderSystem [4135:c07] + NSManagedObjectContext(MagicalRecord)MR_contextWithStoreCoordinator: – > Created:Context * MAIN THREAD * 当我尝试使用后台线程使用以下代码存储我的实体时: [MagicalRecord saveInBackgroundWithBlock:^(NSManagedObjectContext *localContext){ Menu *localMenu = [menu inContext:localContext]; localMenu.name = menu.name; localMenu.menuid = menu.menuid ; }]; 我收到以下错误消息: 2012-10-16 17:05:20.118 OrderSystem [4523:4603] + MagicalRecord(ErrorHandling)defaultErrorHandler:错误消息:操作无法完成。 (cocoa错误133000.) 2012-10-16 17:05:20.118 OrderSystem [4523:4603] + MagicalRecord(ErrorHandling)defaultErrorHandler:错误域:NSCocoaErrorDomain 2012-10-16 17:05:20.119 OrderSystem [4523:4603] + MagicalRecord(ErrorHandling)defaultErrorHandler:恢复build议:(null) 2012-10-16 […]

魔法logging导入已经存在的数据

我试图使用Magical Record导入数据到我的CoreData数据库。 我现在正在处理实体Person 。 一个Person有firstName , lastName , personID属性。 (我知道我不需要idString,我没有在内部使用它,它被用来回话到服务器)。 无论如何,如果我已经有这个人… firstName – John lastName – Smith personID – 1 我下载了JSON … [ { firstName: John, lastName: Doe, id: 1 }, { firstName: Michael, lastName: Caine, id: 2 }, { firstName: Angelina, lastName: Jolie, id: 3 } ] 我想要导入添加Michael和Angelina并将John Smith更新到John Doe因为它已经存在与相同的ID与personID。 我已经设置了id和personID之间的mappedKeyName。 是否有可能做到这一点? 我一直在阅读这个博客… http://www.cimgf.com/2012/05/29/importing-data-made-easy/关于自动映射的关键名称等…并想知道我是否可以利用这要做我想要的? […]

ios – 暂停录像

我试图创build应用程序,用户可以从相机录制video。 此应用程序的function之一必须是暂停文件logging。 例如:用户按“开始”button后开始logging。 一段时间后,用户按“暂停”button,录像暂停。 然后用户按“继续”button,video继续录制在同一个文件中。 有谁能够帮助我? 谢谢。 WBR Maxim

魔法logging和iCloud启用/禁用

如何使用魔法logging处理以下stream程? 假设我的应用程序启用function来打开/closuresiCloud同步。 用户安装应用程序。 在启动时,他被问及iCloud的首选项。 他的select:不要使用iCloud。 用户在应用程序中创build一些数据。 然后,他决定将其存储在iCloud中,并启用iCloud。 后来由于某种原因,用户在应用程序中禁用了iCloud。 数据应该保留在本地。 如何正确设置魔法logging? 更新: 源代码

MagicalRecord:多个数据库

我有一个使用MagicalRecord的应用程序,并且预先使用大量用于参考的数据填充数据库。 在同一个数据模型中,我有用户可定义的信息,关于用户在应用程序中可能做的事情。 该应用程序被拒绝,因为预填充的数据应该被标记为“不备份”。 所以,我想在一个单独的数据存储中保存这些数据,这样我就可以保持用户数据不变。 有没有办法使用MagicalRecord有两个单独的数据存储?