Cannot delete mac alias file - xcode

I am having severe issue with mac alias. I have ana xcode project working fine except recently it denied to find a View controller class ("A.swift") to set in storyboard. Tried many tweaks with zero results. Finally I searched in finder in my main project directory for that view controller file name, and I found that I have some alias file as well for that view controller.
I cannot delete that alias, cannot locate the original file (no information in Get Info, Select New Original... is grayed).
Any help for this?
Note: I have two A.swift files for Mac OS and iOS, both in different directories.

Give it a try with rollback/checkout you last changes if you haven't made big.

Related

QLPreviewView can not show the quicklook preview in sandbox

I use QLPreviewView to show the quicklook preview in the app. Without sandbox, this works well, but once change the app to sandbox, the preview can not show up.
I found the error in Console: QuickLookUIHelpe(20786) deny file-read-data XXX.
I have used the security-scoped bookmarks & com.apple.security.files.user-selected.read-write to grant access the user home dir, then:
[allowedURL startAccessingSecurityScopedResource];
self.myPreiviewItem.myURL = fileURL;
self.myQLPreviewView.previewItem = self.myPreiviewItem;
[self.myQLPreviewView refreshPreviewItem];
[allowedURL stopAccessingSecurityScopedResource];
with these, I can delete files of user home dir, but the QLPreviewView can not work.
I do not know what is the difference between these 2 scenes, does QLPreviewView need more for sandbox?
If I add com.apple.security.files.downloads.read-only into the entitlement, the files in "Downloads" can be previewed, but other files of user home dir can not be previewed.
Finally I have found the solution!
refreshPreviewItem is an async call, so before Mac finishes loading the preview, the following api stopAccessingSecurityScopedResource immediately shutdown the access, as a result, Mac failed to load the preview successfully.
so the solution is: do NOT call stopAccessingSecurityScopedResource here, keep the allowedURL's access right until you do not need the QL preview function, and then call stopAccessingSecurityScopedResource there, such as when closing the window.
I encountered this, or at least a similar, issue a while back (in Mavericks).
This is why I started asking users for access to parent folders of files they wish to Quick Look. Feel free to look at how I do it in this app of mine, version 1.1 at the time of this writing. Just go into Chikoo → Preferences… → Folder Access. Here are two screenshots:
I confess that this is not a great solution. It’s a compromise that I came up with to work around the problem.

Running AntlrWorks2 stand-alone on Windows 7

I must be missing something. After downloading AntlrWorks2 I found the executable bin/antlrworks2.exe and bin/antlrworks264.exe. Aren't these supposed to be the standalone version of the tool? Neither works for me; after a NetBeans splash screen, the first times around I got an error message on missing packages; after a couple of times I chose to go on regardless, but now (still after the initial spash screen) there is simply nothing happening at all.
I can't find any tutorial or manual detailing how to run AntlrWorks stand-alone, so any help is much appreciated.
This is due to a bug in the NetBeans platform. I filed a report but it hasn't received a reply yet:
Cannot launch platform application after moving installation folder
Here is a workaround that does not delete any preferences you have customized:
I found that deleting just the var folder under the user's generated
.antlrworks2 settings folder resolves the issue...
Still an issue as of date of this post. Deleting the .antlrworks2 folder from \users\username\AppData\Roaming does work - you can find this folder by putting %APPDATA% into your file explorer address bar (exactly as shown) - that will go to the app data folder for your current user login session. Delete the .antlrworks2 folder and then re-run the app.

How to register a custom non-document UTI / file type for OSX to recognize it?

I've read all the tickets about this issue, but I still don't get it right. I have a non-document OSX app (for OSX Lion and MountainLion). I want this app to export and import custom data, associated with a custom file extension ".iobs". Internally, these files are just data archived with [NSKeyedArchiver archivedDataWithRootObject:], and saved onto the disk with the "iobs" extension.
So, my check list is this:
1) Export mechanism: checked. My app create correctly .iobs files. If I run "file <filename.iobs>" in the Terminal, I get "iObserve_exportedItems.iobs: Apple binary property list"
2) Declaration of an exported UTI, checked. As shown in the image below. I did NOT declared a custom Document type, since it I never use NSDocument inside my app, and there is no point. Anyway, I already tried and failed. I've tried also different combinations of "Conforms To" entries, but with no success.
3) Is there any 3rd point??? Do I need to start my app once to let the system know? I just ran it in Debug from Xcode so far, and this has no effect. So I guess my Info.plist is wrong, but I filled it from within Xcode4 interface, so???
Thanks for any help, hint, question, suggestion.
Ok, so apparently, I do have to declare a document type even if I don't specify a document class. See the attached screenshot. Note that leaving only the Document UTI doesn't work. I do need the two (exported UTI and document type). Note also that if I say it conforms to com.apple.binary-property-list, I don't have the right icon.
And for those who wonder, there is nothing to do to "register" a type (and its subsequent changes) apart from launching the app once.

Mac OSX 10.7 Lion AUPinkNoise does not compile

Apple Technical Note TN2276 lists changes to audio unit code for Lion. I successfully applied the changes to FilterDemo sample and it compiles ok. Then I apple same changes to AUPinkNoise sample, but I get a linker error says undefined symbol _FilterFactory. I changed code in AUPinkNoise.cpp from
COMPONENT_ENTRY(AUPinkNoise)
to
AUDIOCOMPONENT_ENTRY(AUBaseFactory, AUPinkNoise)
But that does not help. Being new to core audio I have no idea how to fix this. Any ideas?
I had a similar problem, except with another audio unit project. From your description of the error, I think you forgot to edit the .exp file. In the .exp file you should have _"name"Entry and _"name"Factory. For example, in your case in the .exp file (located in the AUSource folder) it should be as follows
1:_AUPinkNoiseEntry
2:_AUPinkNoiseFactory
3:
Remember to have a blank line at the very end.
Also, you will want to edit the info.plist file as well by adding an AudioComponents Array entry and add AUPluginDispatch.cpp/h (located in the AUBase folder).

Deleting CoreData store on OS X?

I'm playing around with CoreData in a Mac OS X application. After changing an entity i got the following error:
The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store.
All answers i've found for this issue suggest implementing versioning/migration into the app, but I'm not interested in saving my data. Isn't there a less complicated solution for that? Like deleting the stock file or something like that? And if yes, where is this file located?
Thanks.
If you don't want the data, then yes, you can simply delete the old file and create a new one. If your data is document based, then the document itself should be deleted. If you use a single store for the whole application (not document based), then you should look in the code that creates the store object to find the location. The template places the creation code in the application delegate, and the default location for the store is in ${HOME}/Library/Application Support/${APP_NAME}/.
On OS X 10.7 Lion when the app is sandboxed, it is stored in:
~/Library/Containers/com.yourcompany.yourAppName/
I found that for Mac OS X 10.8 / Xcode 4.6 the data is stored in the derived data folder of under
Users/*username*/Library/Developer/Xcode/DerivedData/*app name*-*random string*/Build/Products/Debug/*app name*.sqlite
The easiest way to delete this data is to go to the organiser, select project tab and click "Delete..." button by derived data.
Alternatively, For OSX, use the Nsfilemanager to delete the file by using the url defined in the lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator{...}
In this var persistentStoreCoordinator a url will be defined that is designed to be used by the persistentStoreCoordinator. You can just use the url defined there to delete the old store. Insert the below code. Run the project and the file will be deleted. Then delete the code to allow objects to be stored again and not delete the data every time.
here is what I found in the lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("CocoaAppCD.storedata")
here is what i put immediately underneath it.
do{
try NSFileManager.defaultManager().removeItemAtURL(url)
} catch{
print("could not delete file")
}
then i clicked run. It ran once then i delete the code i just made so that the data would not be deleted every time
In macOS Big Sur (11.4), local NSPersistentCloudKitContainer Core Data storage can be found at:
~/Library/Containers/yourAppName/Data/CloudKit/
On Mac OS X 10.11.4 with Xcode 7.3 cleaning the fixed the problem for me:
Product > Clean or Shift⌘K
Try to run the app in a simulator of another device that you haven't used before and see if it helps you (i.e. iPhone SE instead of iPhone 7). If it does, then removing the corrupted folders should help. Open Terminal and run the following commands:
sudo rm -rf ~/Library/Developer/CoreSimulator/Devices
to remove the simulators' data that might be corrupted,
sudo rm -rf ~/Library/Developer/XCode/DerivedData/
to remove your app's data.
Hope that helps!

Resources