Posts

Post not yet marked as solved
4 Replies
1.6k Views
I'm trying to create test cases for my Core Data driven view controllers. One problem I run into is managing temporary persistent containers when the test are running concurrently. I try to get around this by keeping a static copy of the NSManagedObjectModel to pass around the test cases, but it only kind of works. Here is the code - class CoreDataTestCase: XCTestCase {   static var model: NSManagedObjectModel?   var mockPersistentContainer: NSPersistentContainer!       override func setUp() {     print("setUp")     super.setUp()     if let model = CoreDataTestCase.model {       mockPersistentContainer = NSPersistentContainer(name: "MySchema", managedObjectModel: model)     } else {       mockPersistentContainer = NSPersistentContainer(name: "MySchema")       CoreDataTestCase.model = mockPersistentContainer.managedObjectModel     } //    mockPersistentContainer.persistentStoreDescriptions[0].url = URL(fileURLWithPath: "/dev/null")     let description = NSPersistentStoreDescription()     description.type = NSInMemoryStoreType     description.shouldAddStoreAsynchronously = false // Make it simpler in test env     mockPersistentContainer.persistentStoreDescriptions = [description]     mockPersistentContainer.loadPersistentStores { (_, error) in       XCTAssertNil(error)     } ... When I run the tests individually they work, but when I run them concurrently I get the error CoreData: warning: View context accessed for persistent container MySchema with no stores loaded CoreData: warning:   'MyEntity' (0x600002fa6260) from NSManagedObjectModel (0x600003bc8690) claims 'MySchema.MyEntity'. 2021-06-09 13:43:27.663078-0400 MySchema[76742:12179736] [error] error: +[MySchema.MyEntity entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass CoreData: error: +[MySchema.MyEntity entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass 2021-06-09 13:43:27.666042-0400 MySchema[76742:12179736] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An NSManagedObject of class 'MySchema.MyEntity' must have a valid NSEntityDescription.'
Posted
by s.m4.
Last updated
.
Post not yet marked as solved
0 Replies
341 Views
I've been using VNRecognizeTextRequest OCR, and while the accurate setting is great for recognizing words, it's not so good at recognizing individual numbers and characters. VNRequestTextRecognitionLevel.fast works better, but isn't accurate enough for my application. Can anything be done to make VNRecognizeTextRequest better at recognizing individual numbers/characters? I'm using a small regionOfInterest, which seem like it should help Vision find the item.
Posted
by s.m4.
Last updated
.
Post not yet marked as solved
0 Replies
266 Views
I'm working with some data scientists on a coremltools model. I've previously worked with Apple's OCR model, and it can be passed a regionOfInterest with Vision coordinates (normalized, lower-left origin) and return coordinates that are normalized across the entire image frame. It looks like coremltools is passed an image in pixel coordinates. Is there any data available on the Python side to convert the results back into normalized coordinates for the entire image frame? Or is the most they would be able to do is normalize the results across the regionOfInterest?
Posted
by s.m4.
Last updated
.
Post not yet marked as solved
1 Replies
1.8k Views
Here is what I'm trying to do: Users in my app will generally be offline while they use the app to gather data. Then they will move back into WiFi range. I'd like the iOS to trigger a background task when they come back online to upload the data. What I've tried: When the app goes into background mode I submit a BGProcessingTaskRequest (request.requiresNetworkConnectivity = true). I've called _simulateLaunchForTaskWithIdentifier from XCode and everything works perfectly. The problem is that I can't get the background task to trigger for real. I've sat with the app backgrounded with WiFi for a half an hour and nothing uploaded. How long should I expect it to take? Should I be using BGAppRefreshTaskRequest for this use case?
Posted
by s.m4.
Last updated
.
Post not yet marked as solved
1 Replies
3.1k Views
disclaimer - I'm a Swift developer and I'm asking this for Data Scientists who are interested in Core MLA Google search has given mixed results, some pages say that CoreML only supports Python 2.7, some say that it has some support for Python 3 but works much better on Python 2.7, and others say it works on 3 just as well as 2. What is the current answer for this?
Posted
by s.m4.
Last updated
.