Running Uncrustify by selecting Behavior in Xcode does nothing - objective-c

I installed Uncrustify as per the instructions here:
http://noiseandheat.com/blog/2012/01/uncrustifying-objective-c-source-in-xcode-4/
Used brew for installation and added new behavior in Xcode(4.3.2) preferences.
However running the behavior from the menu does nothing. What might I be missing?

For me https://github.com/tonyarnold/Xcode-4-Uncrustify-Automator-Services worked : Automator is used to create a workflow, which will be available in Xcode to format the selected code (The link above could describe a better way - I am just saying what worked for me...)

Thanks Thomas, resource provided by you was very useful and allowed me to add automator workflows into Xcode. Only problem is that script "Uncrustify Document then Re-Indent" is showing an error "System Events got an error: Access for assistive devices is disabled". Initially I sudo touch /private/var/db/.AccessibilityAPIEnabled to enable assistive devices but this did not help.
I found a thread on similar issue here: AppleScript - System Events Error : Access for assistive devices is disabled
fanaugen says:
The problem is not the assistive devices. AppleScript seems to incorrectly return that error code when it tries to access windows of a process that can never have any windows
and he suggest to rewrite script with some changes. I am not sure if it is actually the same issue here and it's first time I am having to deal with this type of script, so I am lacking of knowledge here. Do you have any advice? Did you have a similar issue?

Related

Using new iTunesLibrary Framework to access iTunes library on Mac OS-X

I've been looking at adding iTunes Library access to a Mac app I'm developing.
I looked at some of the existing open source implementations, such as EyeTunes and iMedia - but found them to not be quite what I was looking for. Overkill in general.
So I tried out using the Scripting Bridge, and found that while functional it was slow. And since I didn't really need to control iTunes, the slowness was not worth it. It also had the downside of relying on iTunes to be running. It also is a bit irritating to get it working in a sandboxed app (though possible.)
So I finally started to roll my own by reading the iTunes Library.xml file. That seems to be working OK. But in the process of investigating the meaning of the Distinguished Kind key/value I stumbled upon a brand new, Apple supplied iTunesLibrary.framework !!!
Beautiful - the iTunesLibrary framework docs are here.
However, when I try to initialize the framework using the code as shown in the reference link:
NSError * error = nil;
ITLibrary* library = [ITLibrary libraryWithAPIVersion:#"1.0" error:&error];
It returns nil and provides the very helpful error like so (in my Sandboxed app):
Error Domain=NSPOSIXErrorDomain Code=100001 "Could not load."
UserInfo=0x1140025b0 {NSLocalizedDescription=Could not load.,
NSUnderlyingError=0x1026fbe20 "The operation couldn’t be completed.
(OSStatus error -50.)"}
Thinking it might be a sandboxing issue, I also created a quick command line utility that attempts to init the library and it returns an almost identical error:
Failed to open library: Error Domain=NSPOSIXErrorDomain Code=100001
"Could not load." UserInfo=0x1018015b0 {NSLocalizedDescription=Could
not load., NSUnderlyingError=0x103a000e0 "The operation couldn’t be
completed. (OSStatus error 100005.)"}
Has anyone else tried out this new iTunes Library framework with anymore luck than I have had?
// EDIT: Answer below is correct. Code signing is required. The sample code in the answer is a handy starting point for using the framework. Additionally, in my case the problem was also that the iTunesLibrary framework code does not appear to work when the iTunes library is hosted on a network drive. Make this a bit of a deal breaker unless Apple fixes it.
You'll need to codesign your app using a certificate from the Mac Developer Program.
It's not documented anywhere, but, my suspicion is that this requirement was added due to iTunes cloud being a web service thing that requires accessing user accounts.
// Edit: In addition to setting CODE_SIGN_IDENTITY in the project settings as discussed above, you will also need to add /Library/Frameworks to the FRAMEWORK_SEARCH_PATHS in the project settings so that Xcode will know where to look for the #import's.
// Edit 2: I wrote a quick little sample app to show how iTunesLibrary is used, since, Apple's sample code and documentation is rather sparse: https://github.com/zadr/iTunesLibraryExample
From iTunes Library Framework Reference
You must code sign your app in order to get information back from the
iTunes Library framework.
The iTunes Library framework is available to users running iTunes
v11.0 or above.
Not sure if this is true for all of you, but in my case, I kept Code-Signing-Identity to - helped me. Now I don't need to sign the app.

Code Sign error: The identity 'iPhone Distribution:' doesn't match any valid, non-expired certificate/private key pair.. Any solutions?

I'm in the process of writing and deployment of my first iOS application. When I tried to build release build (flavour) of my project for real iOS device (I select Release in project schema and choose Products->Archive). I got an error as in the question title. Trying googling I found that it's a very popular error and only on stackoverflow there are nearly four threads for it. But trying to follow advices listed there changed nothing.
I tried to change certificate keys preferences (code signing identity) in the Targets->Build Settings in different ways. I also tried to change them directly via xcodebuild. Eventualy, I've tried all the combinations (developer/distribution). May be this settings even don't relate to this problem - i don't know.
So the question is there some exact solution for this problem?
I had the same issue when I upgraded to xcode 4.5 iOS 6. Just go to organizer and select profiles and when you see your distribution click on it and remove it. Then try to refresh. It will connect to developer site and download your current distribution profile. Then when trying to choose your profile in your project you can see the new set of profiles which will work. Just make sure your distribution profile is current. That should so it.
Adrian
Found another esoteric thing that needs to be checked if you're still getting this error after having tried everything. Make sure the code signing selections under TARGETS->Build Settings isn't overriding what you've set for code signing in PROJECT->Build Settings.
This error came up for me because I did not have scheme setup in debug mode.
Option Click on the run button pops upa window in which you should be selecting 'Debug' for "Build Configuration".

API documentation: LSOpenURLsWithRole()

Recently, starting Preview on a list of gif images produced the error :-
LSOpenURLsWithRole() failed with error -600 for the file /Users/uki/repos/gif-fuzzing/test/234.gif.
However on opening 234.gif the error could not be reproduced. This error keeps repeating at random intervals of time. I've been searching around for Apple Developer Documentation on what LSOpenURLsWithRole actually does, but I could not find any(which is weird).
Could anyone point me to where the API docs of this function would be?
Has anyone had a similar error before?
fbernardo's link provides a good starting point... In this case, it's a more generic error as explained here:
https://web.archive.org/web/20191128225313/http://office.mvps.org/error/number.html#error-600
An inability to send a 'launch' event to the mach port sounds like a runtime kernel level issue... in my case, it was a zombie of a process I'd killed form the terminal holding on to certain resources, which only a reboot could solve.
I had the same issue, and found a fix without rebooting. If you Kill the WindowServer the issue with Finder no longer opening windows will be resolved. You will be returned to the login screen, and when you login again Finder should be working perfectly!
This function was available in version 10.4 to 10.10 of MacOS.
It's official complete documentation is here:
LSOpenURLsWithRole Apple documentation
To answer:
Has anyone had a similar error before?
Yes with many different applications and with many different versions of MacOS. For example, I am running a clean version of MacOS 10.13.5 where this function is deprecated. Nonetheless I have a process track which shows /usr/bin/open is calling this function.
See this other question:
Old bug: The application “Preview.app” is not open anymore

bootstrap server. Error in iPhone SDK

Can anyone help for the following ERROR:
Couldn't register com.india.XXX with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.
here m using xcode 4.1 and i have same project folders in my local desk.
When ever i open multiple projects with the same name its showing the above error.
Thanks in advance.
Some of the fixes that the links Saif contain may work for some, but not for me.
I have a very simple solution without restarting that will usually get you through the day.
When you get this error, before you do anything else, build for the other device (if you are running a universal application).
When you build for the other device, it kind of "overwrites" the process that creates this error. Once the other device is up and running, immediately build for the device that created the error. This will work most if not all the time, and will save you time digging through the multitude of fixes you will find in the other links.
I tried almost all of the fixes found there and none of them worked in my case. This works, but you should check your appDelegate for any bugs in your willEnter/didEnter (and other related methods).

"the program being debugged is not being run."

I'm running Xcode, trying to get my app to run on my iphone. I'm getting the error message "the program being debugged is not being run."(no solution like restarting device/xcode/mac, reinstalling provisioning profile,unplug/replug device,reinstallation of app on the device works for me)
:( :(
Try removing ALL expired provisioning profiles (even unrelated to current app) on your device. You can do this by going to Settings app->General->Profiles (on the device), and then "Remove" the ones that show as expired. This has worked for me in the past.
Don't know if you've solved the problem. What worked for me was to set all linked libraries (one of them was still set to simulator and/or distribution) to the same build configurations.
change provisioning profile select through Info
I changed selected provisioning profile from Ad-Hoc to Developer and the problem solved.