Cannot get permission in Xcode - xcode

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

Related

Record Level Spotlight indexing with Coredata

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).

XCode 4.2 Source Control problems

I seem to have a major problem. I opened up Xcode and my main view controller code seems to have been replaced with the original code, it's all gone. All my other files have the little 'M' for modified icon next to them, this problem file however does not. It seems like it's gone back to the original version.
Now, Can I go back to my modified version, or is it all gone? This is a for a test app so although not crucial, I'd really prefer to not lose it all :)
Thanks
Just putting an answer here as I hate to leave things with no answers. Dropbox sorted my problem as I had a backup copy of everything, and I am yet to find out what went wrong. I'm now using a combination of Dropbox and a GIT repo to keeps things save.

Is it possible to find a deleted xcode file?

I highlighted a line of code I was going to delete after building and running the app. After I ran the app, the code was still highlighted so I pressed delete and my entire class was deleted... I am an idiot...
The file did not go to the trash so I thought xcode might store it somewhere, does anyone know if it is possible to retrieve this file?
you can easily revert if you are using version control. if you are not using it (yet), you should -- worse things happen.
if you don't use version control and you use xcode's snapshots... you could look there. you may also be able to find it using Time Machine.
but... add "learn version control" to your #1 thing to learn this week for development.
I used the Disk Drill to restore mistakenly deleted files.
check http://www.cleverfiles.com/

svn conflict xcode project file while working in team

I'm working in a team that's developing iPhone application (about 7 people). We use SVN for source code control of iPhone code, we keep running into conflict issues with xcode project file and iPhone nib file. I think there has been a question asked about this problem : How to merge conflicts (file project.pbxproj) in Xcode use svn?. I want to ask if anyone has ever come up with a satisfactory solution to this. Since our team is fairly decent in size (7 people), manually resolving conflict in xcode project file everytime someone changes code, or adding new object into nib file is a huge productivity waste. Has Apple engineers ever thought about this issues when they wrote their own iPhone apps ? I have been looking for a satisfactory solution using Google and Bing, not yet found one.
Thanks,
This is definitely a HUGE flaw with xcode. I'm on a team of similar size and here's what I do to make the process as painless as possible:
SVN update (ALWAYS do this before a checkin as well):
quit Xcode. The quickest way to do this is to use Alfred and type "forcequit xcode"
"svn up" in the project folder from command line
If you have any merge conflicts with the project file, hit "edit" to open in emacs or whatever
search for "======" to find merge conflicts; delete that line as well as the "<<<< mine" and ">>>>" lines
save & exit. hit "r" to mark project as resolved.
re-open project - "open MyProject.xcodeproj/"
With a bit of practice you can get this process down to under a minute (I do this several times a day).
for NIB files, DO NOT work on while someone else is working on it. There's no real way to merge them. Make your changes quickly and check in right away (there aren't many cases where 2 people need to work on a NIB file at the same time anyway). For less complicated views, just lay them out programmatically.
Try installing SourceGear DiffMerge. This is a merge tool that should make it a lot easier to merge the changes. Also see this blog post about configure XCode to use DiffMerge

xcode and ad-hoc-distribution: can i bring xcode to automatically make an .ipa?

can i make, that when compiling in the adhoc-profile, i made for xcode, pack it into a zip complaining to itunes or an ipa, give it an automatic name (optional ... appname_date_time.zip) and copy it to a network-path ?
so, what is really my problem: i think i understood, that in a past-build-phase i can run a shell-script. but i haven´t done many shell-scripting now. can i zip on osx with the shell and for this case in a simple way ?
and can i let the message "no provisioned iphone connected" be gone ?
why ?
i want, that some company-internal people can load my software without email-spamming on each new release.
ok, build and archive builds at least the .ipa automatically. the rest might be just a second click and a script. so if no one has a more elegant solution, this is enough
Check out the BetaBuilder gem - https://github.com/lukeredpath/betabuilder. It worked about 90% of the way for me - I had to re-route its guts a bit to make it work, but my fork (https://github.com/dts/betabuilder) works for me. Hopefully, you can cobble together a solution for you (it was worth the effort for me!)
You can automate this, but need to get after the code signing, which is behind the last build phase you can add to Xcode. So the solution is creating a new aggregate target and define the shell script in there.
Here is an example of the whole process including a readme file on how to set it up: https://github.com/TheRealKerni/HockeyKit/tree/develop/client/iOS/Beta%20Automatisation

Resources