core-data

Magical Record import with already existing data

不问归期 提交于 2020-01-12 07:51:06
问题 I'm trying to use Magical Record to import data into my CoreData db. I'm working on the entity Person at the moment. A Person has firstName , lastName , personID attributes. (I know I don't need the idString, I'm not using it internally, it is used to talk back to the server). Anyway, if I already have the person... firstName - John lastName - Smith personID - 1 And I download the JSON... [ { firstName: John, lastName: Doe, id: 1 }, { firstName: Michael, lastName: Caine, id: 2 }, { firstName:

Save object in CoreData

让人想犯罪 __ 提交于 2020-01-12 07:49:11
问题 I am using CoreData with iPhone SDK. I am making a notes app. I have a table with note objects displayed from my model. When a button is pressed I want to save the text in the textview to the object being edited. How do I do this? I've been trying several things but none seem to work. Thanks EDIT: NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject =

Core Data attribute changes to nil (ARC related?)

一笑奈何 提交于 2020-01-12 07:30:07
问题 I have some Core Data functionality that was working fine until some recent (seemingly unrelated) changes were made. Now I'm getting problems where all the attributes belonging to a particular NSManagedObject subclass instance are suddenly returning nil. Let's say my NSManagedObject subclass is called Foo and it has only one attribute called value. Once I realised value was somehow becoming nil I went and setup the following category to monitor changes to value. @implementation Foo (Debug) -

iOS: Using @min and @max in a core data predicate

倖福魔咒の 提交于 2020-01-12 05:35:06
问题 I have a core data entity, Client , which has a discount property. I want to fetch the the client with the smallest discount. I am using the following NSPredicate : [NSPredicate predicateWithFormat:@"@min.discount"]; However, I am getting the following error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "@min.discount"' What am not doing right? 回答1: I don't think NSPredicate has support for functions like this unless it is

'NSPersistentContainer' is only available on iOS 10.0 or newer

一个人想着一个人 提交于 2020-01-12 04:01:11
问题 I am new to IOS app development. I have developed an app which shows a website on user login. It works with deployment target set to 10.1. Inorder to make it comptaible with IOS 8 I am trying to set deployment target to 8 because of which I am below error. 'NSPersistentContainer' is only available on iOS 10.0 or newer Can anyone help with code what I need to change to make it compatible with IOS 8,9 & 10. Xcode:8.2.1 Swift version: 3.2 import UIKit import CoreData @UIApplicationMain class

Replace core data model without migration

半世苍凉 提交于 2020-01-12 03:42:26
问题 I have changed my core data model quite extensively. There are loads of question how to migrate the old data into the new model, however i don't need to migrate anything. I just would like to replace the current Core Data instance. How can this be done? 回答1: I'm going to assume you're using a persistant store coordinator with NSSQLiteStoreType . Just change the name of the url for your persistant store coordinator. If the previous version used a url called MyApp.sqlite , change it to

Core Data privateQueue performBlockAndWait deadlock while accessing relationship

不羁岁月 提交于 2020-01-12 03:33:33
问题 This topic has been discussed at many forum, but I am still not able to fully understand how performBlockAndWait actually works. As per my understanding, context.performBlockAndWait(block: () -> Void) will perform the block in its own queue while blocking the caller thread. Documentation says that: You group “standard” messages to send to the context within a block to pass to one of these methods. What are the "standard" messages? It also says that: Setter methods on queue-based managed

Xcode 9.2 UIDocumentBrowserViewController : Failed to create a url from bookmarkableString

半城伤御伤魂 提交于 2020-01-11 19:59:50
问题 Update: Xcode 9.3 has fixed it. When creating UIDocument File in UIDocumentBrowserViewController [default] [ERROR] Could not resolve bookmark. Error: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.} [DocumentManager] Failed to create a url from bookmarkableString (Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the

Xcode 9.2 UIDocumentBrowserViewController : Failed to create a url from bookmarkableString

点点圈 提交于 2020-01-11 19:59:07
问题 Update: Xcode 9.3 has fixed it. When creating UIDocument File in UIDocumentBrowserViewController [default] [ERROR] Could not resolve bookmark. Error: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.} [DocumentManager] Failed to create a url from bookmarkableString (Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the

iCloud Core Data Not available after running in Xcode 6 / ios 8 SDK

回眸只為那壹抹淺笑 提交于 2020-01-11 19:58:21
问题 I have an app that uses Core Data with iCloud sync. It works great in iOS 7. I'm having some trouble since running it in XCode 6 though, even on an iOS 7 device. Here's my test: on iOS 7 device: Download current live app from app store Sync data from iCloud Build and run new version of app Persistent Stores change, original data no longer available Here's screen shots of my provisioning profile and xcode setup: I've also tried the following entitlements: Just com.apple.developer.icloud