vinnycoyne.com
Magical adventures in nerdery.

BTLog - Bluetooth NSLog() for iOS Devices

[This is an old post that I've brought over from the old vinnycoyne.com blog. I've updated the download links to point to the repo over on GitHub]

I'm currently testing & debugging an iOS app, which is logging quite a bit of location-related data using NSLog(). This is fine when I'm tethered to my MacBook Pro, but it's not so great for testing in the field.

So, rather that lugging around the MBP, I decided to make use of the various iOS devices I have lying around and turn them into a console for NSLog() data. It's pretty basic right now (and not exactly production-ready), but it works well.

I should also note that the portion of code which overrides NSLog() came from c99koder's lastfm-iphone source code.

Add BTLog to your own app:

  1. Download the BTLog project files here and add BTLog.h and BTLog.m to your app's Xcode project.

  2. Add GameKit.framework to your Xcode project.

  3. In main.m, add: #include "BTLog.h" Note that that's include and not import!

  4. In your app delegate's header file: #import "BTLog.h" and in your declarations (in the same file): BTLog *btLogger;

  5. In your app delegate's implementation (.m) file:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        btLogger = [[BTLog alloc] initWithDelegate:self];

        // ...

}

(you can put this anywhere, but I find it handiest here.)

Note that the delegate is set to self — we're doing this so that the following method gets called — put it anywhere in your app delegate's .m file:

-(void)logStringToRemoteDevice:(NSString *)string {

        if (string.length > 0 && btLogger) {
                [btLogger logString:string];
        }
}
  1. Download the BTLog project here (if you haven't already) — build it in Xcode & install it onto any iOS device running 3.x or higher. Launch your own app (modified with the steps above) on your testing device.

Connect the two apps over Bluetooth and you should see your NSLog() strings appear in the BTLog app.

If you spot any bugs or have any suggestions for improvement, drop me a line.

Feel free to use this in any app that you're developing, but don't forget to remove the code once you begin building for production!


iOS Review Popup

I recently gave a talk titled "7 App Store Tips" at the Dublin Web Summit.

One of the tips I discussed was the use of an in-app alert, which reminds users to rate/review your app on the App Store.

I've since tidied up my code a little and uploaded the class for re-use within your own apps.

Download the code here.

Usage:

VCReviewPopup* popup = [VCReviewPopup sharedPopup];

popup.appStoreURL = [NSURL URLWithString:@"https://itunes.apple.com/ie/app/eirtext/id286099297?mt=8"];

popup.numberOfDaysBeforeShowingPopup = 14; // Show alert after two weeks

[popup showAlertReminderAfterDaysHaveElapsed];


How do I set up a US iTunes account?

Seeing as the new Apple TV has just been released and is winging its way to lucky TV addicts around the globe, it's only a matter of time before this question crops up again.

The Apple TV is a lovely device, but content selection outside of the USA stinks. In some cases, it's non-existent. So, let's show you how to set up an account, which will let you get the most entertainment out of your new toy…

Read More →


Automating your iTunes video (somewhat)

I tweeted a while back that I was working on some scripts which would help automate the process of batch-importing .avi video files in iTunes for use on my Apple TV. Some folks asked how they could set it up for themselves.

At the time, I was using a couple of Automator scripts, which were triggered by folder actions. They worked, but not very well, so I never posted them online.

Since then, however, I've found a much simpler way of converting & importing using an Elgato Turbo.264 HD dongle and a copy of VideoDrive.

Read More →