CoreData: error: Failed to load model named LocalStorage
importJSON2/UploadStoreData.swift:51: Fatal error: URL doesn't contain valid data
Illegal instruction: 4
If the command-line command works when run from within Xcode but produces this error when run from the command line in a different folder, the problem is that the model it's looking for is stored externally from the command in the modelName.momd folder.
This will be present in the Xcode-produced Products/Debug folder but not in the folder you're trying to run it in.
Copy the modelName.momd folder (complete with its contents) to the new folder and try again. Voila!
Fatal error: URL doesn't contain valid data
Illegal instruction: 4
I get this error when I try running a command to import JSON to Core Data but the import JSON file doesn't exist where I have said.
It's also possible that the file doesn't contain valid JSON. Check that too.
Add/move the JSON file to where is should be
No such module *moduleName*
You've added a package to the project in Xcode via Add Package, but when you go to use any of the modules in the package, the project/target won't even build and you get the error No such module
.
You tear you hair out an scream at the computer, "It's right there! I just put it there! You just put it there when you added the package!…"
Go to ProjectName Build Phases
and expand Link Binary With Libraries
and add the library there.
Yes, it seems that Xcode should do that, but it doesn't.
dyld: Library not loaded: @rpath/*name*.framework/Versions/A/*name*
Referenced from: /Users/.../Developer/Repos/abc/./importJSON
Reason: image not found
Abort trap: 6
The @rpath
is a clue: it means the command needs to use a framework that was complied with it but the rpath
(i.e. run path) doesn't contain that framework. That's because Xcode doesn't automatically put it there.
I moved the compiled name.framework from the Xcode-produced Products/Debug folder to /usr/local/Frameworks and in Xcode added LD_RUNPATH_SEARCH_PATH
= /usr/local/Frameworks so the product can be run from any directory
Note: it is not necessary for the path to be /usr/local/Frameworks. It can be any path you want; you just have to be consistent with pointing LD_RUNPATH_SEARCH_PATHS
to the path you moved/copied the framework to.