Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

grandM

macrumors 68000
Original poster
Oct 14, 2013
1,539
304
Hi

My app uses Core Data and works like a charm when I run it from Xcode. When I press the stop button the simulator goes back to the launch screen. Normally when I press the app icon the app launches. Now it just bounces back.

Does anyone see a reason why?

Thanks
 
Could be a lot of things. What have you tried to fix it? Does it still occur when you run it on a different type of iPhone in the simulator?
 
What does your console say? If you have made any changes to your Core Data Entities or attributes that could be a reason for the crash. Try deleting it from your home screen and reloading it.
 
^ I think it's that

If you're not migrating your persistent store after a change, you will get a crash when it is loaded into the data model because it won't match.
 
What does your console say? If you have made any changes to your Core Data Entities or attributes that could be a reason for the crash. Try deleting it from your home screen and reloading it.
I don't think so. I did change the entities but delete the app every time before running it in Xcode. Upon closing Xcode I try to re-run in the simulator, then it fails. Or must I keep Xcode running?
 
I don't think so. I did change the entities but delete the app every time before running it in Xcode. Upon closing Xcode I try to re-run in the simulator, then it fails. Or must I keep Xcode running?
Unless you can give a lot more details it's very difficult to help you. This is one of those problems that could have a lot of causes. A lot of things have to go right in those first 1000 milliseconds after you tap an app icon.
 
Unless you can give a lot more details it's very difficult to help you. This is one of those problems that could have a lot of causes. A lot of things have to go right in those first 1000 milliseconds after you tap an app icon.
I do not know what is going wrong. If I run the app from Xcode the simulator starts up and everything works. As the app uses Core Data I wanted to test it out. So I hit the stop button in Xcode. Then my simulator shows the app icons. I tap the app icon and I see a white screen appearing. Then it shifts back to the icon. Nothing more happens. I do not know how I can give more information as I'm not running it from Xcode at that moment?
 
Unless you can give a lot more details it's very difficult to help you. This is one of those problems that could have a lot of causes. A lot of things have to go right in those first 1000 milliseconds after you tap an app icon.
I made progress. Apparently it has something the do with my cache. When I disable caching the problem disappears. Caching seems useful though. Can somebody explain me how to make caching work properly?
 
Unless you can give a lot more details it's very difficult to help you. This is one of those problems that could have a lot of causes. A lot of things have to go right in those first 1000 milliseconds after you tap an app icon.

I put the caching back on but deleted the cache if the resultscontroller differs from nil. Does this make any sense?
Code:
var fetchedResultsController: NSFetchedResultsController {

        if_fetchedResultsController != nil {

            return_fetchedResultsController!

        }

       

        NSFetchedResultsController.deleteCacheWithName("Master")
 
Without knowing all the detail, I'll go out on a limb with a guess:

Could it be that a thread is holding cache and/or waiting for a response?

Is there some kind of flush command that should be called before closing a thread?

If they have a cache, there should be something to indicate if there is something there or pending cleanup calls.
 
Without knowing all the detail, I'll go out on a limb with a guess:

Could it be that a thread is holding cache and/or waiting for a response?

Is there some kind of flush command that should be called before closing a thread?

If they have a cache, there should be something to indicate if there is something there or pending cleanup calls.
I'm using the splitviewcontroller template. This does indeed use a cache called Master in its NsFetchedResultController. I do set predicates and so on upon creation of the fetchedResultController but do not seem to set those elsewhere again. Hence I am a bit puzzled why it had a problem with the cache. Now I've solved it with the code above hence clearing the cache when the fetchedResultController is called upon. At that moment predicates and so on are set too.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.