Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Experto Crede
Aug 19, 2008

Keep on Truckin'
Does anyone know of a simple guide on how to create a menulet in OS X using NSStatusItem?

I've tried the guide here but it's quite outdated.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Here, I'll make you one.

1. Make a new application.
2. Delete the window.
3. In your app delegate, create an NSStatusItem via [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength].
4. Set its menu and give it an icon or title.
5. In Info.plist, set LSUIElement a.k.a. "Application is agent (UIElement)" to YES.
6. Build and run.

Feel free to request expansion of any of these steps.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



There's a thing I've been wondering about with custom NSFormatters. I have a subclass that I've attached to a column in XCode. When the window is initlializing, there's a call made to -stringForObjectValue: with the first parameter being an __NSCFString containing "Text Cell".

That is, it's like it's trying to have the formatter turn the cell's description(?) into a string, not the object represented by the cell. As soon as the window populates, the actual objects represented by the cell are passed, and I get the expected output.

Anyone seen this? I just upgraded to Mountain Lion & XCode 4.4, but I've been seeing it since Leopard at least.

dizzywhip
Dec 23, 2005

Is there a place to get information about deprecated Cocoa API in Mountain Lion? I've been using the function GetMacOSStatusErrorString to log Core Audio error messages, but it appears to be deprecated in Mountain Lion, so I'm looking for an alternative. The header file simply says it's deprecated without telling you what to use instead. I found a document in the dev center saying it's deprecated, but again it doesn't provide an alternative. Any ideas?

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



As far as I can tell, GetMacOSStatusErrorString is part of CarbonCore?

How are you obtaining the error code? It looks like something like this will work if you only have the numeric error code:

Objective-C code:
    NSError *err = [NSError errorWithDomain:kCFErrorDomainOSStatus code:-30 userInfo:nil];
    
    NSLog(@"%@", err);
will output things like:

2012-07-26 08:24:49.944 Test[2231:303] Error Domain=NSOSStatusErrorDomain Code=-30 "The operation couldn’t be completed. (OSStatus error -30.)" (dceExtErr: dce extension error)
2012-07-26 08:27:37.792 Test[2354:303] Error Domain=NSOSStatusErrorDomain Code=-20 "The operation couldn’t be completed. (OSStatus error -20.)" (writErr: I/O System Errors)

You can then use NSError's various methods to obtain a name and description.

dizzywhip
Dec 23, 2005

Yeah, each core audio function returns a numeric error code, so whenever there's an error I want to log a useful message so I know what's going on. Unfortunately it seems like NSError only gives me generic "The operation couldn't be completed" messages, while GetMacOSStatusErrorString would usually give me a more descriptive message. I'll use it for now to get rid of the warnings though, thanks!

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



No problem! I was thinking about the part after the generic one, "(writErr: I/O System Errors)" - it's not possible to get at those? I suppose if there isn't an accessor for that part of the error message, you could get the description and parse that though that's a horror.

dizzywhip
Dec 23, 2005

Hmm, I actually had missed that part of the message. It doesn't seem like NSError lets you access that part directly, but since these aren't user-facing error messages they don't need to be formatted nicely. As long as I can see the message I'm happy.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
It's not in userInfo?

dizzywhip
Dec 23, 2005

Nope, when I log userInfo it's just an empty dictionary. Which I think makes sense because I'm passing nil for userInfo in the initializer.

zergstain
Dec 15, 2005

Now that 10.8 is here, is it possible to sign apps so they won't be blocked by gatekeeper with a free developer account?

Doc Block
Apr 15, 2003
Fun Shoe
Yes, sign up for a free Developer ID.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Which requires membership in the $99/year Mac Developer Program.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Yeah Gatekeeper-happy app signing takes $99 out of your pocket each year.

Tools Workflow Guide for Mac posted:

In some cases, you may want to distribute an application outside the Mac App Store. In that situation, use a Developer ID certificate to give your users assurance that you are an Apple identified developer.

OS X Mountain Lion users will have the option of turning on Gatekeeper, a security feature that gives users the ability to choose to install software only from the Mac App Store and identified developers. If your application is not signed with a Developer ID certificate issued by Apple, it will not launch on systems that have this security option selected. To avoid this situation, sign your applications and installer packages using a Developer ID certificate and thoroughly test the end-user experience using a Gatekeeper enabled system before you distribute your application outside of the Mac App Store.

...

But before you can get started, you must be a member of the Mac Developer Program.

duck monster
Dec 15, 2004

pokeyman posted:

Yeah Gatekeeper-happy app signing takes $99 out of your pocket each year.

img-richard-stallman-vomiting-over-everyone.tiff

Doctor w-rw-rw-
Jun 24, 2008

duck monster posted:

img-richard-stallman-vomiting-over-everyone.tiff
He's always had a point, theoretically. Now why did Apple have to go and prove him right? :qq:

I might actually switch back to Linux over this. :qq:

haveblue
Aug 15, 2005



Toilet Rascal
You can still do whatever you want to your own computer, the dev tools are free to download and gatekeeper doesn't care about code generated locally. I'm not getting too worked up over a small serious-callers-only measure attached to distributing executables. You can even still be Stallman-compliant because gatekeeper also has no problem with source distribution.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

lord funk posted:

I've tried for a few days now, restarting, reloading, and it still won't recognize the server. It's odd, because the button only appears if the server is active on the network, so it clearly sees that it's there. I wonder if my app doesn't meet a requirement for AirPlay (audio session type, for example).


OK I am using the session type AVAudioSessionCategoryPlayback and no overrides. I noticed your app shows the recording toolbar when outside the app and that category does disable AirPlay.

Are you doing it to silence system sounds or to do actual recording? For actual recording only enable that when recording and drop back to AVAudioSessionCategoryPlayback the rest of the time. You may also need to reinit the MPVolumeView after making this change but it should allow the AirPlay icon to pop up.

lord funk
Feb 16, 2004

Ender.uNF posted:

OK I am using the session type AVAudioSessionCategoryPlayback and no overrides. I noticed your app shows the recording toolbar when outside the app and that category does disable AirPlay.

Are you doing it to silence system sounds or to do actual recording? For actual recording only enable that when recording and drop back to AVAudioSessionCategoryPlayback the rest of the time. You may also need to reinit the MPVolumeView after making this change but it should allow the AirPlay icon to pop up.

Excellent - thanks for checking. I didn't know you could switch session types while the app is running (I'm assuming you'll have to tear down / rebuild the audio session?). The record category was chosen because it will have input capabilities someday.

This is great - now I just have to figure out latency...

Star War Sex Parrot
Oct 2, 2003

I swapped my iPhone under AppleCare today and without thinking went straight to iOS 6 beta without adding it to my Provisioning Portal. Now the phone is useless because it can't activate, and I can't figure out any way to get the UDID in this state or go back to 5.1.1. I know I can get it if it's connected to a machine with Xcode, but I don't have access to my development machine right now.

Any ideas while I start the Xcode download on this machine?

edit: I never did a backup of this brand new device so there's no UDID folder within /Backups.

edit 2: DFU mode to the rescue!

Star War Sex Parrot fucked around with this message at 18:49 on Jul 27, 2012

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!

lord funk posted:

I didn't know you could switch session types while the app is running (I'm assuming you'll have to tear down / rebuild the audio session?).

Yep. I wrote some words last week about what it took to manage audio almost properly for my game. It's a bitch and took a weekend of headscratching.

Built 4 Cuban Linux
Jul 15, 2007

i own america
Is there any way to create a UIView outside of a view controller in a storyboard? It was possible with xibs. I liked to do some design in interface builder and then link the view to a property in my code so I could programmatically load it. I can't figure out a way to do it without putting it over my view controller in a storyboard and hiding it (which is just a complete mess to work with).

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I think you need at least one view controller in your storyboard, so you can't add a view to a storyboard with zero view controllers.

However, if you already have a view controller and need an outlet to another view, you can certainly drag a view from the object library into that view controller. Wire up an outlet and you're good to go.

If you want, you can make a new storyboard, add a plain old UIViewController and give that an identifier, then play with its view. You can then load your storyboard in code, grab the view controller by its identifier, then grab its view. It's a bit roundabout but it should work.

And finally, nibs continue to work perfectly well :)

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Duck monster posted about his GHUnit/Jenkins setup almost a year ago. Has anyone else messed with iOS continuous integration recently? I'm going back and forth a bit between giving Jenkins a try (which my former boss tried.. he said it was an absolute nightmare and gave up) and rolling my own very basic CI system. We already have a build server doing daily builds and building/signing/uploading tagged Git commits to our deployment system, but hooking in unit tests and notifications is going to require something more heavy duty than we have now.

I'm thinking I may set a time limit of x hours to attempt to get Jenkins working before giving up and whipping something up in Python.

Hog Obituary
Jun 11, 2006
start the day right
We're using Jenkins and it runs builds on every commit (or on some timed interval, I forgot what). This includes running the test suite as well. I can write something up on it tomorrow... or did you have a specific question?

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
I'm just curious what different people are using and the general pain/benefit ratios. At this point I know that I could at least get every commit built and packaged and wire in some kind of notifications myself, but there are obvious benefits to using a much nicer package that isn't all my own, especially when our Java server guys want to hook in.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
There was a great WWDC presentation this year entitled "Building from the Command Line with Xcode" that featured a demo in which a presenter sets up a Jenkins buildbot in about five minutes, so I'm kindof skeptical of the "absolute nightmare" claim. I'd at least check the video out before rolling your own CI system.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
The good news is that we've had command line building and signing working for months with few to no issues. It took me several hours today to get logic unit tests going, but it all seemed to work as intended by the end of the day. I'd think plugging into Jenkins/Hudson would be the easy part.

I guess I'll give it a shot.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
That WWDC video seemed awesome, but I am already seeing why my boss said Jenkins just doesn't work. I set up the Git plugin to grab our repo, and it just hangs at cloning forever. I know that its ssh keys aren't set up yet, so that's probably what's going on, but it gives literally no error message, nothing in the log, and never gives up until you hit cancel. Looks pretty nightmarish if the slightest thing goes wrong.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Wow, that is pretty terrible; sorry for not being more skeptical.

Doctor w-rw-rw-
Jun 24, 2008

ManicJason posted:

That WWDC video seemed awesome, but I am already seeing why my boss said Jenkins just doesn't work. I set up the Git plugin to grab our repo, and it just hangs at cloning forever. I know that its ssh keys aren't set up yet, so that's probably what's going on, but it gives literally no error message, nothing in the log, and never gives up until you hit cancel. Looks pretty nightmarish if the slightest thing goes wrong.

Haven't seen the video, but I set up Jenkins + Git + Xcode at work without even consulting Google or StackOverflow. It *is* easy. Worked fine.

lord funk
Feb 16, 2004

Any idea why the actual device wouldn't correctly setHighlightedTextColor for my cell, but the simulator would?


(simulator on right)

The device is running 5.0.1, the simulator is running 5.1.

edit: well, I guess that's it (the OS version), but it seems a silly thing to bump the development target from 5.0 to 5.1. What changed? :confused:

lord funk fucked around with this message at 23:13 on Aug 1, 2012

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
It only took me four or five hours to hit a total dead end with Jenkins. I can't get it to use the correct RSA key to clone from GitHub, and it is impossible as far as I can tell to determine what RSA key it is trying to use if any at all. You can make it run as a "jenkins" user instead of "daemon", but you cannot actually log into that user to troubleshoot the key issues. I put the key pair into /Users/Shared/Jenkins/.ssh and /Users/Shared/Jenkins/Home/.ssh assuming one of the two is correct. No dice. This is extremely frustrating.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

ManicJason posted:

It only took me four or five hours to hit a total dead end with Jenkins. I can't get it to use the correct RSA key to clone from GitHub, and it is impossible as far as I can tell to determine what RSA key it is trying to use if any at all. You can make it run as a "jenkins" user instead of "daemon", but you cannot actually log into that user to troubleshoot the key issues. I put the key pair into /Users/Shared/Jenkins/.ssh and /Users/Shared/Jenkins/Home/.ssh assuming one of the two is correct. No dice. This is extremely frustrating.

You can't sudo -u jenkins /bin/bash?

Also, I found this: http://stackoverflow.com/questions/6692330/how-to-run-jenkins-as-a-different-user

Doctor w-rw-rw-
Jun 24, 2008

ManicJason posted:

It only took me four or five hours to hit a total dead end with Jenkins. I can't get it to use the correct RSA key to clone from GitHub, and it is impossible as far as I can tell to determine what RSA key it is trying to use if any at all. You can make it run as a "jenkins" user instead of "daemon", but you cannot actually log into that user to troubleshoot the key issues. I put the key pair into /Users/Shared/Jenkins/.ssh and /Users/Shared/Jenkins/Home/.ssh assuming one of the two is correct. No dice. This is extremely frustrating.

Oh. GitHub. We're not using GitHub. But ssh permissions on keys can cause problems if you accidentally make them too broad, if memory serves.. The .ssh directory should be 700 and the private keys on my computer are 600 (public are 644).

You're running it on OS X...inside Tomcat? Outside? Not sure if that's the problem, but I'm running it on CentOS inside a Tomcat install, and running a OS X computer (a VM, really) as a slave. The tomcat user's homedir is set to .jenkins inside the "tomcat" directory inside the apache tomcat directory (the one with webapps, bin, lib, logs, etc). Permissions weren't hard to set.

You can probably just sudo -u jenkins -s, then try "ssh -vv git@github.com" to see what it's offering, but you can also just set up a .ssh/config file. Try finger -m jenkins to see if its home directory is what you expect it to be.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Well, I made some progress finally. I couldn't su jenkins because the OSX Jenkins installer set its shell to null. I've never used dscl before, but I finally stumbled around enough to set its shell to bash, su jenkins, and then fix the git cloning issues.

I also managed to get some keychain issues sorted out, so that's good.

Now my problem is that our current setup has one repo for some shared network protocol and another repo for our actual iOS builds. Our builds don't work right if they two repos are not in sister directories.

It looks like there are quite a few ways around this, though none of them are great. I tried the multiple SCM plugin and had some path issues. I may try setting a different job for our shared network protocol repo and then linking each of our iOS jobs to it somehow or vice versa.

Progress at least!

Built 4 Cuban Linux
Jul 15, 2007

i own america

pokeyman posted:

I think you need at least one view controller in your storyboard, so you can't add a view to a storyboard with zero view controllers.

However, if you already have a view controller and need an outlet to another view, you can certainly drag a view from the object library into that view controller. Wire up an outlet and you're good to go.

If you want, you can make a new storyboard, add a plain old UIViewController and give that an identifier, then play with its view. You can then load your storyboard in code, grab the view controller by its identifier, then grab its view. It's a bit roundabout but it should work.

And finally, nibs continue to work perfectly well :)

Yeah, I was fine with them being part of a view controller, the problem was just interface builder forcing you to design within that 480x320 window. Oh well! Thanks, I may throw some nibs in

Athrok_01
Sep 19, 2002

"No one understands my angst." - Emo Elmo
How much should I expect to pay a developer an hour?

I'm using an access database through Glassdata right now, but I think it would serve better as a standalone app.

I think it's a simple project:

20 tables with one variable.

I'd like to be able to :
Chart the trend for each variable
Have a number pad pop up for entering each update
See the updates for the day on one form
Save files to upload files to a server for sharing between multiple users

How easily could this be done?

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Built 4 Cuban Linux posted:

Yeah, I was fine with them being part of a view controller, the problem was just interface builder forcing you to design within that 480x320 window. Oh well! Thanks, I may throw some nibs in

You can set the view to 'freeform' in the inspector and you can resize it willy nilly. Alternately, you can trash the stock view your XIB gets created with and drag in a new UIView and it will be set to freeform by default. Just remember to hook up the file's owners view outlet to the new one if you do it that way.

Lumpy fucked around with this message at 05:11 on Aug 2, 2012

Adbot
ADBOT LOVES YOU

Hibame
Feb 20, 2008
At work I am working on a prototype application for the iPad and learning all the fun apple related stuff (xcode & objective-c) at the same time. I am trying to make heavy use of UITableView with lots of custom cells. I really want to use UITableView for user input much like the iOS settings views. Every example I have found to do this manually creates each cell with a big if else block inside cellForRowAtIndexPath. Is there a better way to go about this for larger input views?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply