I’ve decided to abandon WordPress for now and switch over to a geekier software package, Octopress. My new URL is:
Posts in category Uncategorized
Adium always presenting Apple Quarantine Message
I’ve been getting a warning dialog on my Mac (Lion 10.7) when opening Adium. It recently updated to the newest beta and is presenting the following quarantine message every time I open it -
“Adium.app” is an application downloaded from the Internet. Are you sure you want to open it?
Every other time I have gotten the quarantine message, it clears itself after the first launch. This time it did not. I found a quick and easy way to remove the quarantine extended file attribute:
sudo xattr -d -r com.apple.quarantine /Applications/Adium.app
Relaunch Adium one more time with the “first time you’ve opened” warning and you’re set!
Missing AccessibilitySettingsLoader bundle with iOS 5.0.1 debugging
After upgrading my iPhone 4 to iOS 5.0.1, Xcode has been giving me the following error message when debugging my Migraine Diary app remotely:
warning: Unable to read symbols for /Users/aaron/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/AccessibilityBundles/AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader (file not found).
warning: No copy of AccessibilitySettingsLoader.bundle/AccessibilitySettingsLoader found locally, reading from memory on remote device. This may slow down the debug session.
I tried deleting the directory and having Xcode pull down the symbols off of the phone again. No success. I ended up copying the contents of the main SDK bundles into the one in my local library. Solved it. Not sure if this is the right solution but it works. I vaguely remember this happening last time Apple released a small point release.
So copy the following directory:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/AccessibilityBundles
to:
/Users/[your login name]/Library/Developer/Xcode/iOS DeviceSupport/5.0.1 (9A405)/Symbols/System/Library/
iOS Basics: nil vs NULL vs NSNull
Yes, there are three ways to represent a null value in Objective-C.
NULL = Absence of a value with C-style pointers
nil = Absence of value with Objective-C object variables
NSNull = A nil boxed as an object for storage in a collection
If you try adding nil to a NSDictionary or NSArray, you will find out it doesn’t perform as expected. If you absolutely need to store a null value in a collection, you can use NSNull to represent the lack of a value. For example:
NSNull nullValue = [NSNull null]; [anArray addObject:nullValue];
Note, however, that since NSNull represents the lack of a value, there is no way to retrieve that value from the collection. In order to determine if there is no value for a particular key or index, you must compare against NSNull.
id value = [anArray objectAtIndex:3];
if (value == [NSNull null]) {
// Do something for a null
}
iOS – Customize Table View Cells
Ever wanted to have alternated colors on your table view cells? If so, you’ve probably done something inside of cellForRowAtIndexPath and applied a background color to your cell there.
Would you be surprised to know that’s completely wrong? Yup. Wrong. WRONG WRONG WRONG.
I didn’t know this, but any styles applied to cells based on state or whatever should really be in willDisplayCell – NOT when you configure the cell itself! Per Apple’s documentation for the Table View delegate -
“A table view sends this message to its delegate just before it uses cell to draw a row, thereby permitting the delegate to customize the cell object before it is displayed. This method gives the delegate a chance to override state-based properties set earlier by the table view, such as selection and background color. After the delegate returns, the table view sets only the alpha and frame properties, and then only when animating rows as they slide in or out.”
Keep this in mind especially if you’re using a NSFetchedResultsController with CoreData. You’ll have to issue a [tableView reloadRowsAtIndexPaths:...] in your didChangeObject method. For some reason, at least in iOS 4.3.3, the willDisplayCell isn’t firing with the default code Apple recommends when using a Fetched Results Controller. Adding that reload does the trick.
iOS – Pull App Version From Bundle Configuration
We all like to put the current application version number in an “about” screen somewhere for users to reference. It’s a pain, however, to have to update that screen every time we do a release as well as the version in the target configuration for the bundle. So why not pull the version number from the bundle? Here’s how to do it:
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
Just put this version number in your label programatically and you’re set! Since my About screen is in a nib/xib, I set the label text to “Version x.x” so I would understand the label isn’t static next time I look at the screen in Interface Builder.
Time Warner Cable Power / SNR Acceptable Values
I recently upgraded my Time Warner Cable RoadRunner service to the RoadRunner Extreme 30Mbps down / 5Mbps up service. Part of that service upgrade required a new modem to be installed and a technician to come out to validate line quality values. Turns out, I could have done a self install myself and saved the $30 but I wasn’t given that option even after asking.
In any case, while the technician was at my house I noticed on his computer screen power levels and signal to noise (SNR) levels for my modem. Right next to it were the acceptable ranges that Time Warner allows. I asked if I could take a picture of his screen, which he refused, but allowed me to record the values. Here I present them to you for your reference with my values in parenthesis.
Upstream Power -> 33dBmV to 51dBmV (47.7)
Downstream Power -> -10dBmV to 9dBmV (-3.2)
Upstream SNR -> 20dB to 99dB (36.1)
Downstream SNR -> 25dB to 99dB (34.7)
You can get to these stats by going to your modem when you are at home at http://192.168.100.1. Depending on the model and version of software on the modem, you may have to enable a higher level of access on the device to get to the screens with these values on them. Simple Google searches can provide the methods to access these screens for your modem model.
iTunes Connect – Invalid Binary
I spent the past week pulling out my hair trying to submit an update for Centare’s EyeOnWeather application to iTunes Connect. I kept getting a reject from the system and all I got for an error message was “Invalid Binary.” THANKS, THAT’S SOOPER.
Eventually I ended up attempting to contact iTunes Connect Support for further details. I thought it might have been missing icons, malformed Info.plist, something. I haven’t changed anything in the project drastically with how it builds, so I was at a loss. Turns out, I was picking the wrong provisioning profile in my setup. Man I felt stupid. Ends up that I’m not crazy – Apple’s documentation on how to set up your project for building still only references Xcode 3. Awesome for the rest of the world using Xcode 4. Here are some tips I got from Apple iTunes Connect support for pulling in information to submit to their developer team:
(replace 'path/to/myapp.app" with the actual path to your application): codesign --verify -vvvv -R='anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and certificate leaf[field.1.2.840.113635.100.6.1.4] exists' /path/to/myapp.app codesign -dvv /path/to/myapp.app - This command is useful to see what certificate was used to sign your app. If under the section labeled "Authority" it says iPhone Developer, this means that your app was signed with your Developer Certificate. If it says iPhone Distribution, this means that it was signed with your Distribution Certificate. codesign -d --entitlements - /path/to/myapp.app
I ended up pulling the EyeOnWeather.app file out of my archive bundle to be sure I was testing what I sent up to iTunes Connect. You can also just do a “Build for Archive” and then right click your .app in Xcode under Product and “Show In Finder”. Drag that file into Terminal and it’ll paste the full path & filename.
Running those commands gave me confirmation of this – I was code signing with my developer profile. Even though you pick the Distribution certificate in the submission window for uploading, it doesn’t change the signature of the app. The solution was to go into my setup for the build and change the Code Signing Identity for the “Release” configuration to the Distribution profile. I deleted the old “Distribution” build configuration that I had created back in the Xcode 3 days as it’s no longer appropriate.
This link is the defacto WTF help me document for code signing in Xcode 4:
Technical Note TN2250 – Understanding and Resolving Code Signing Issues
UITextView having rounded corners
I’ve been using a UITextView in an app and realized that it didn’t have any rounded edges like the default behavior exhibited by the built-in iOS apps. For example in the calendar app, setting the Notes field shows:
Inside of Apple’s Human Interface guidelines it specifically states “A text view is a rounded rectangle of any height. A text view supports scrolling when the content is too large to fit inside its bounds.” Adding a UITextView to a view shows square corners by default. So how the hell do you get rounded corners? Interface Builder doesn’t show anything about corners. Seems like the only way to get this behavior is by doing the following in code:
- Add:
#import <QuartzCore/QuartzCore.h> - And then add:
textView.layer.cornerRadius = 10.0f;
Replace textView with the variable pointing to your UITextView.
Xcode 4 – Problem submitting App with Static Library
I’m submitting a new version of my Migraine Diary App to the App Store and was running into problems with Xcode 4 giving me the following error: “[Your App Name] does not contain a single-bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single-bundle application.”
There is an issue or maybe it’s an intentional design thing with Xcode 4 and how it handles statically built libraries being included in your project. I’m specifically using Core Plot and it’s instruction set hasn’t been updated for Xcode 4 yet. Here are the things I had to do to get Core Plot to bundle correctly with my App to submit it:
- Click on the Core Plot project which should be a child of your App’s project.
- Click on the Project CorePlot-CocoaTouch and go to the Build Settings. Set “Skip Install” to Yes.
- Click on the CorePlot-CocoaTouch target and set “Skip Install” to Yes.
- Click Build Phases and under Copy Headers, move all of the Public and Private entries to the Project section.
You should then be able to build your project for Archive and submit to Apple.
Thanks to Apple Dev Forums – https://devforums.apple.com/thread/86137