I've read the tutorial at https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/SpotlightCoreData/Articles/recordLevel.html so many times now, I can't seem to get it for some reason.
I've tried creating the spotlight importer, manually copying it to ~/Library/Spotlight with no success.
Can anyone be point me to a working sample of CoreData-Spotlight-OSX app? a remotely basic thing would suffice.
The xcode template default-stores .importer in the bundle-resources folder, I've read in other places that it should be in a Library/Spotlight folder if the app is sandboxed.
again, tried & failed.
help!
I’ve written a CoreData / Spotlight importer. It’s always a bit of a struggle, even in the best of times. I wrote mine before those docs, and before they’d written the daemon that writes out the records for you. When the CoreData team first did their version of my solution theirs had several critical bugs which prevented me from using it, so I reported them and switched back to mine—I hope by now they are fixed, but this is something to be aware of.
The other thing to know is that a lot of app-makers (including me) have found Spotlight importing of CoreData records is broken on Mavericks, apparently because of changes in the sandbox. This has been widely reported and I’ve filed a bug. If you’re on Mavericks you might be hitting this problem as well.
But, to debuggin:
The first thing you should do is add some NSLogging to your importer, and check your Console after you make a change to your database. Wait to see if any process that starts with “md” (metadata) reports errors, or if you see the logs your wrote.
Also, do a man mdimport and the run mdimport from the command-line on your plug-in with one of the record files. With mdimport’s -g option you can test your importer wherever it is, and with -d4 you’ll get a lot of debugging info.
You can also do a mdimport -L to see if your importer is being seen by the system.
In general, you need to find out ⑴ does your importer work or does it just crash (by running it directly with mdimporter) ⑵ does the system see your importer and recognize that it’s in charge of stubs with your chosen filetype (mdimport -L) and ⑶ does your importer have permission to see the record files (by running your app and watching the Console).
Related
I've written a quick look plugin to preview my custom file type, but it doesn't work when embedded in my OS X app bundle. Running "qlmanage -m plugins" doesn't show my UTI
Manually copying the qlgenerator file from myApp.app/Contents/Library/QuickLook/ to /Library/QuickLook/ and running "qlmanage -r" makes the quicklook preview work.
Do you have to do something special in the hosting app to register the embedded quick look plugin with OS X?
Extra notes: (I don't know why these would matter since the qlGenerator works when I manually copy it, but maybe this information will help)
During build, I get this warning about the qlGenerator:
"warning: skipping copy phase strip, binary is code signed"
The copy build phase is set up like so:
I got it working, but there wasn't a straightforward solution. A couple things I did:
I didn't have the exported UTIs set up properly for my application. I looked at the plist of some other applications to see how they did it to fix this.
I had lots of copies of my app all over my system. They all mentioned the same UTI, so there is a possibility that these were confusing quick look. I deleted them all.
I disabled code signing on the quick look target. This fixed the warning I was getting. The ql plugin gets code signed by the application it gets bundled into.
I sent my application to other computer's /Applications/ folder and tested there. Seems like the quick look daemon wouldn't clear it's cache for application-embedded quick look plugins. I may have lost it a little, but it seemed like there might have been something special about dragging the application to /Applications/ and launching it from there that would kick start the quick look daemon.
Some combination of these things caused it to start working.
(Un)Happy coding :(
To anyone who can help,
So I confess to not being great with computers or apps. In fact, this is my first experience creating an app, so please be nice with me. The app I am creating is for a school project and needs to be able to record audio and save these recordings. In order to do this, I added "AVFoundationFramework" to the build phases under "Link Binary With Libraries" and attempted to edit AVAudioRecorder.h in the style of what it says to do on the online Developer Tools. I got this error message:
"'AVAudioRecorder.h' is locked for editing and you may not be able to save your changes. Do you want to unlock it? 'AVAudioRecorder.h' is currently locked because you are not the current owner of the file and do not have write permission." And then it gives me the options "Don't Unlock" and "Unlock". Note that I got the latest version of Xcode that I am using in the App Store and never moved it or any of the Xcode files I have worked with to or from any other computers, so this should not be an issue.
When I hit "Unlock", this message displays: "The file 'AVAudioRecorder.h' could not be unlocked. Could not add write permission to the file because you do not own it. Try modifying the permissions of the file in the Finder or Terminal."
I did both of those things - I made sure I have Read & Write permission for the folder its in, and I hit "Apply to Enclosed Items" and that didn't work. I got help from someone better with computers than me and we looked in the Terminal and, according to him, I have permission according to the Terminal. I then took my computer to the Apple Store, where they found AVFoundation as a file in my Hard Drive and gave it Read & Write permission in there, and they did some other things as well that I didn't understand involving permissions. They even re-installed my computer and that didn't help.
So I'm at a loss. I apologize if this has been asked already, but I did look and see if anyone had asked similar questions and gotten any answers other than what I have already tried that hasn't worked. The closest I found was this in response to a very similar question with UIViewController.h where he said:
"This looks like you attempted to edit a header file belonging to a system framework in iOS which are protected against unintentional changes like this, possibly because the assistant editor in Xcode (usually shown in the right-hand editor) showed this header at some point.
The only solution here is to revert your changes unless you know exactly why you are making changes in those files."
Sadly I do not know what this means and can't work from there. So if someone can either explain what the above quote means in simple terms OR how to otherwise fix the problem, that would be amazing.
First off, congrats on your first app! To answer answer your question: don't do this! ;-) You should never edit SDK header files. These warnings are for your own benefit. You can really screw things up otherwise. Not sure what info/documentation you were seeing that made you think that you were supposed to, but that's definitely not the right thing to do. But don't feel bad... this stuff is confusing at first.
I would suggest you find an example app that does recording and playback, compile it in Xcode, and make sure it works on your device. Then study it. See how they did things. Create your own Xcode project and try to recreate what they did. That's probably the best way to approach learning this.
Here's a tutorial showing how to use AVAudioRecorder that you might find helpful. Good luck!
http://www.techotopia.com/index.php/Recording_Audio_on_iOS_7_with_AVAudioRecorder
Im finding myself using TextMate 2 more and more for development these days
One thing that is bugging me is that it does not seem to reload a file when it is changed externally.
This is a big problem since I use terminal to switch git branches a lot, and it often results in accidentally saving an older version over the new branch
Sadly the TM team seem to have disabled the Issue tracker on github, and documentation just seems scattered far and wide over the web in tiny scraps.
Any ideas?
Right now it reloads the file silently whenever the file on Disk is changed. There is currently no option for a prompt.
Regarding the closed issue tracker: As an alternative, you can always send a mail to the Textmate users list if you find a problem.
I just updated to TM 2. In the past, I have enjoyed using TM to view development.log as I am introducing new or modified code. TM 1 would ask me if I want to revert to what's on disk and of course I would respond with Yes. Then I could see any additions to the log file. Occasionally I would empty the log file with Cmd+A, Delete, Cmd+S. Macromates, please make TM 2 work like TM 1 reloading content.
I also could not find a solution to this problem which is still there, however it is possible to file an issue using this contact page: http://macromates.com/support
Additionally there are hidden setting which cannot be set from the GUI. Unfortunately they don't include and setting for automatic load from disk: https://github.com/textmate/textmate/wiki/Hidden-Settings
To track changes in OSX filesystem while an installer runs I'm trying to use the fs_usage.
Can somebody guide me with a simple example on how to interpret the result. There a lot of terms I don't understand when I examine it.
fs_usage's output tends to be full of irrelevant chatter, and hard to interpret. I'd recommend using fseventer, which just shows changed files without all the nonsense. If you're an Apple developer, you can also use PackageMaker's snapshot package feature (which records everything that happens, and offers to make an installer package that does the same things).
I have a series of logging breakpoints in Xcode4 that I'm using to selectively log things as I need them. However, whenever I make changes to the code involving adding or deleting lines, these breakpoints get out of sync with where they are supposed to be, sometimes even going to a completely different function.
Is there a way to keep the breakpoint in sync with the code, rather than just rely on the line number?
I believe it should, at least it's the IDE's usual behaviour.
Just a thought. Have you tried to reinstall XCode? I have experienced all sorts of weird bugs since the upgrade to XCode 4. For example, being unable to select a XIB file for a popup window in a project---and when creating a project from scratch, I was able to select that XIB and create the popup. At the time I posted a question on StackOverflow about this and it is still unanswered ever since.
Since that time, the project was overhauled and now I build my interfaces from scratch using full Obj-C code, dumping the interface builder 99% of the time...