core-data

How to sum the numbers(Int16) of stored core data - Swift 3

戏子无情 提交于 2020-01-23 03:32:44
问题 I have stored the letters(String), numbers(Int16) and Date(Date) in the core data. And the filter(NSPredicate) succeeded in organizing only the necessary data. I want to get the total sum of the numbers in this core data. Entity Name : Entity Attribute Name : Letter(String), Value(Int16), Date(Date) let context = (UIApplication.shared.delegate as! AppDelegate).managedObjectContext let entityDesc: NSEntityDescription = NSEntityDescription.entity(forEntityName: "Entity", in: context)! let

Can HTML5 localStorage in Cordova/Phonegap app be synced to iCloud?

帅比萌擦擦* 提交于 2020-01-23 02:56:07
问题 I have a Phonegap/Cordova app that runs on iOS. It saves it's data into HTML5 localStorage. I'm trying to work out if it's possible to sync the localStorage data (using iCloud) to other iOS devices, and even OS X. From what I can see, in iOS localStorage is actually implemented as a SQLite database, which (when using Phonegap/Cordova) is written to the app's Documents directory: Documents/Backups/localstorage.appdata.db I also understand that there are three main ways of storing data in

Using Core Data and in insertMethod App crashes and give NSInternalInconsistencyException with error message Context already has a coordinator

非 Y 不嫁゛ 提交于 2020-01-23 02:35:10
问题 i am implementing a core data example in xcode 4.2 at insertMethod (in MasterViewController.m class) my app crashes with a NSInternalInconsistencyException and error message: Context already has a coordinator; cannot replace. can any buddy tell me the meaning of this exception and error message insert method given below:- (void)insertNewObject { detailViewControllerObj = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil]; detailViewControllerObj.delegate = self;

Fetched Properties inside NSFetchedResultsController's predicate

 ̄綄美尐妖づ 提交于 2020-01-23 01:54:10
问题 I have an Artist object with a .localConcerts fetched property (basically a subset of the full . concerts set), can I use that property inside my NSFetchedResultsController predicate? Here's what I'm trying: NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Artist" inManagedObjectContext:context]; [request setEntity:entity]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"localConcerts.@count > 0"]; [request

iOS 12 Errors: appears to be from a different NSManagedObjectModel than this context's

左心房为你撑大大i 提交于 2020-01-23 01:24:29
问题 I started to get the following error when launching my application on iOS 12 simulator. Did anybody face issue like this? 2018-08-11 21:17:44.440144+0300 CafeManager[4633:128874] [error] error: The fetch request's entity 0x600001f6e940 'TablesTable' appears to be from a different NSManagedObjectModel than this context's I have global constant defined in AppDelegate: let viewContext = AppDelegate.viewContext And use it with NSFetchedResultsController for UITableView update, for example: import

How do I improve performance of Core Data object insert on iPhone?

﹥>﹥吖頭↗ 提交于 2020-01-22 20:38:06
问题 I'm trying to import a large amount of data into a core data store on the iPhone. I'm using a SQLite backing for the core data store. It seems to be taking way longer than I would expect it to. I've trimmed down the routines so that it is basically just attempting to a fetch an object (to see if it already exists) and then create a new object if it doesn't (they never do since I am importing data). The fetching isn't the time consuming part, though. It's the creation of the objects. Basically

Core Data fetch request fails with: 'NSInternalInconsistencyException', reason: 'statement is still active'

假装没事ソ 提交于 2020-01-22 19:42:05
问题 Basic app layout using the navigation controller template with core date: Delegate: persistenceCoordinator, managedObjectModel, managedObjectContext RootView: managedObjectContext (from delegate), addManagedObjectContext (using the pattern from the templates), fetchResultsController Add/Edit view (a hierarchy for adding Object A & its B) I have two objects, A & B that share a 1-to-1 relationship/inverse relationship Using the pattern from the templates the app: Creates an

Sync core data database/ .sqlite file to Dropbox

主宰稳场 提交于 2020-01-22 16:35:09
问题 I'm trying to sync/upload my core data database/.sqlite file to dropbox. once my user logs in, i have a button to upload the file: -(IBAction)sync{ NSString *localPath = [[NSBundle mainBundle] pathForResource:@"cache" ofType:@"sqlite"]; NSString *filename = @"cache.db"; NSString *destDir = @"/"; [self.restClient uploadFile:filename toPath:destDir withParentRev:nil fromPath:localPath]; } But the problem here is: I dont know the name of my .sqlite data base, I've looked under : ~/Library

Cloud storage options with iOS

半腔热情 提交于 2020-01-22 15:15:05
问题 I'm trying to create a back-end in which I can have many users communicate with each other amongst an iPhone app I'm creating. I've tried working with Core Data, Google App Engine, Google Cloud Storage, and Amazon Web Services (RDS & Elastic Beanstalk). Unfortunately, after weeks of trying to get any of this working, none of it will! I've been trying to get in touch with someone who would know how startups (when they were little) like Instagram, Path, and Pinterest have managed to do this.

CoreData and RestKit performance while importing very large datasets

偶尔善良 提交于 2020-01-22 15:03:43
问题 I am using RestKit for fetching JSON data on various endpoints (on iOS platform). There are several questions on SO which point to the same direction like that one: Importing large datasets on iPhone using CoreData But my question is still a different one, because I know, if the JSON file gets too large, I have to cut it into chunks. I'll do that! How exactly is the importing done with CoreData in RestKit. Seems that there is a parent/child contexts setup, which is very inefficient when