Closed danydev closed 10 years ago
Good catch. Will be merged. :) Thanks.
Nice! just amended, to enforce space indentation.
ps: what about providing simulator version on the Project Browser? I think it is a good idea, since currently I'm not able to understand what I'm opening if I have the same app on 2 different simulators.
If you think it is ok, can you advice me on where to put this information? (maybe a new label? So we'll have model, store, and iOS version, or just appending to the title? Something like: My App - iOS 7.1
)
Thanks again!
I think simply appending the version to the title is good enough. But before we continue I think we should refactor the code in CDEProjectBrowserWindowController
and especially in -reloadProjectBrowser:
. The code in this method is really fragile. For example, for some unknown reason, I get an exception (see screenshot) when I try to get the metadata of a file that is potentially a store file.
If I find the time/strength I will refactor the code there myself... if not I will create an issue for that... I don't want to tell you to not append the version of the simulator now. Do it if you want but we may run into merge conflicts if we do. :D
Any input is appreciated: https://github.com/ChristianKienle/Core-Data-Editor/issues/20
I had a look at your changes again. Your assumptions about the directory structure are no longer true with Xcode 6. We need a more robust solution.
@ChristianKienle Yup, I was not so happy about that assumption but it was true for any Xcode I ever tried :D I stil don't have installed Xcode 6.
From a quick look, it looks like we can solve the problem using the command line tool simctl
, we could use it to obtain the iOS version of the specific simulators and then trying to determine that store\model belong to the same simulator.
Obviously it means that this particular function can be activated only if we detect simctl
(i.e. Xcode >= 6)
We need just to do some work on parsing the result list of simulators from the command line, I can do it in the next week or so, let me know what you think.
I noticed that when I opened the "Project Browser", some applications were duplicated.
While debugging the code that retrieves the apps list, I noticed how it duplicates
storePath
andmodelPath
when you installed your app in more than 1 simulator.MyApp is installed on iOS 7.1 and iOS 6.1 simulators, and it produces the following array
CDEProjectBrowserItem *
CDEProjectBrowserItem1 .../7.1Applications/412F2A6B-0F54-4F98-AE1B-DFE99E057DB1/Documents/MyStoreFile.sqlite, .../7.1/Applications/412F2A6B-0F54-4F98-AE1B-DFE99E057DB1/MyApp.app/v1.momd/v1.mom,
CDEProjectBrowserItem2 .../6.1Applications/F3B606E7-8CC1-48E9-944D-079CE1F77173/Documents/MyStoreFile.sqlite, .../7.1/Applications/412F2A6B-0F54-4F98-AE1B-DFE99E057DB1/MyApp.app/v1.momd/v1.mom,
CDEProjectBrowserItem3 .../7.1Applications/412F2A6B-0F54-4F98-AE1B-DFE99E057DB1/Documents/MyStoreFile.sqlite, .../6.1/Applications/F3B606E7-8CC1-48E9-944D-079CE1F77173/MyApp.app/v1.momd/v1.mom,
CDEProjectBrowserItem4 .../6.1Applications/F3B606E7-8CC1-48E9-944D-079CE1F77173/Documents/MyStoreFile.sqlite, .../6.1/Applications/F3B606E7-8CC1-48E9-944D-079CE1F77173/MyApp.app/v1.momd/v1.mom,
Note how we don't want to have CDEProjectBrowserItem2 and CDEProjectBrowserItem3 (i.e mixing apps with different app folder in different simulators) I applied a fix, playing with a NSURL category in order to retrieve the app folder name, making sure that the
storePath
app name matches themodelPath
app name. There is an assumption that the app folder name is in the path component after "Applications", and that 2 simulators haven't an app with the same folder name (UUID) but I think it is fine. An alternative could be to enforce it inCDEProjectBrowserItem
constructor, returning nil if model and store path belongs to different simulator\apps Guys, let me know what you think.