Skip to content

This is the future

I just got done typing a post on a forum for a game I play on my iPad. The thread was about rules for the multiplayer environment of the game.

In the course of writing that post, I opened a Safari tab to look up a particular homophone, another tab to pull up a copy of the U.S. Constitution, another to read the Wikipedia entry for “Strict Constructionism”, and the Dictionary app.

All for a simple few-paragraph forum post, so I could clearly and authoritatively articulate my opinion on the topic.

As minuscule as it seems, that is technology at its finest. All the knowledge of the world at your finger tips. Instead of avoiding the homophone and choosing a different word, I learned what it was. Instead of writing a sloppy sentence, I was able to construct one that alluded to the parallelism of the Constitution’s preamble. Instead of speaking ignorantly, and to better understand my own opinions, I read the Wikipedia entry on “Strict Constructionism” and was reminded the term used to describe the competing philosophy, “Original Intent”.

What fascinates me most is how I use technology in this way without even realizing it. There’s almost no conscious consideration in the decision to open a Safari tab mid-sentence to research something relevant to the sentence’s next word.

And yet schools, kindergarten through high school (even some higher education), fail to teach these kinds of skills and habits, and instead focus on the limited potential of sheer memorization.

Just sayin’.

It’s an amazing new world. Embrace it.

Categories: misc, random.

DPScrollingLabel

Summary
A UILabel-like UIScrollView subclass that scrolls horizontally when the length of its text exceeds the length of its frame.

Installation
To install, just add DPScrollingLabel.h and .m to your Xcode project.

Usage
Initialize an instance of DPScrollingLabel with -initWithFrame: and add it to your view hierarchy.

You can customize the label’s font, textColor, and highlightedTextColor. Set the text with -setText:.

And for the scrolling functionality, you can change the distance between the end of the text and the start of its next instance when scrolling.

You can also change the amount of time it pauses before continuing to scroll, as well as the amount of time it takes for a full scroll.

(See DPScrollingLabel.h for a full list of functions.)

DPScrollingLabel is offered with the MIT License and can be downloaded via GitHub.

Categories: classes, code.

DPSlidingImage

Summary
While attempting to design an interface similar to the Music app’s Now Playing screen, I realized there was no built-in option–in either CAAnimation and its subclasses or in the UIView animation methods–to effectively push one image away with its replacement image (i.e., when you skip tracks in the Music app and the album artwork slides from right to left).

There was one option: a CATransition option called Push that would theoretically do what I was looking for — but unfortunately that particular option also adds a fade effect to the slide, which, in this circumstance, is far less aesthetically appropriate.

So I wrote a simple UIView subclass called DPSlidingImage that essentially acts as UIImageView capable of switching images with a sliding animation to either the left or right.

Installation
Simply add both source files to your project and import DPSlidingImage.h where you need it.

Usage
Simple enough:

Create an instance of DPSlidingImage using -initWithFrame: and add it to your view hierarchy.

To set the current image, call -setImage:goRight:animate:. (It’s pretty straightforward: if you send YES to animate, it will by default slide the images right-to-left. If you send YES for goRight:, the sliding effect will go from left-to-right.

You can also obtain the currently-displayed image conveniently by calling -image, and access the underlying UIImageView object by calling -imageView.

Misc
I wrote this early in my development, um, development, so I imagine it’s not the most efficient way to perform this particular task. But it does the job, and I’ve been using it in OnCue for years.

Please feel free to improve upon on it, or submit questions / comments / suggestions.

DPSlidingImage is offered with the MIT License and can be downloaded via GitHub.

Categories: classes, code.

No iTunes Match in OnCue, and Here’s Why (Plus: Why OnCue refreshes the library so damn often)

(I originally sent this in an email to a user who discovered OnCue needed two refreshes before it was able to see a song downloaded from iTunes Match. I felt that others may appreciate this information, so I’m reposting it here.)

iTunes Match has been one of the biggest pains in my ass since it was announced.

Apple provides *zero* documentation to developers, and zero access to any tools that would allow our apps to interact with or access Match in any way. I can’t even see which songs are in the cloud but not downloaded — only songs already on your device.

iOS sends out a general “library changed” notification whenever something in your music library is changed, either via iTunes or in the Music app. The problem is, these notifications don’t explain what’s actually changed. Which is why the app goes through the whole “Refreshing library” thing all the time. The app won’t know if songs are deleted or added or if someone just changed a song title until it scans the entire library and compares it with the current library.

I imagine what happens is when you start to download a track, iOS sends out the notification because something has been altered in the Music app. However, OnCue still won’t see the new track, because the notification was merely notifying of the beginning of the download. Without the download actually complete, OnCue has no access to that file.

So a refresh that’s performed–either automatically or manually–after a song has finished downloading probably will find the new track — because at that point the file has been added to the local library and is thus accessible to OnCue.

I hope that makes sense.

I wish there was a better way of handling this, but so far I got nothin. Other music apps, like Groove or Track 8, are seemingly capable of accessing and playing iTunes Match music. But the difference is those apps are not technically third-party music players. They are merely front-ends to the Music app. They remotely access and control the functions of the Music app, which is why it seems like they can access iTunes Match.

Because of the functional requirements of OnCue, I couldn’t use that option. I had to develop a music player from scratch, which requires accessing the actual files in your music library (which are inaccessible if they’re only in the Cloud). By using this method, I’m able to incorporate advanced queue management, which the Music app doesn’t support. It also allows OnCue to operate fully in the background, and it offered the flexibility for me to develop the crossfading feature, which is also unsupported by the Music app.

This is why most music player apps can’t do what OnCue does, and also why those apps that try to do what OnCue does also face the same iTunes Match limitations.

Categories: misc, oncue.

Tags: , ,

The new blog

Welcome to the new blog.

Check here for my obviously-invaluable commentary on app / web development and design, as well as random musings on politics because everyone knows discussing politics is a great way to make friends.

I’ll also post a lot of information related to my app, OnCue, The Music Player. So if you’re an OnCue user and wanna stay in-the-know, this is the place to check. (To avoid the other stuff and see only OnCue-related posts, you can use this address.)

Categories: oncue, Uncategorized.

Tags:

OnCue 5.2, Coming Soon

iCloud sync. Twitter. Podcasts+bookmarks. And lots of little stuff.

Categories: oncue, upcoming features, updates.

Why does OnCue crash after I update it?

7 simple words: Core Data managed object model version migration.

OK, maybe not so simple.

And that’s kind of the problem.

Let’s say, for instance, I want OnCue to keep track of how many times each song was played, so it can be used in a Smart Queue. I would need to add a field–”playCount”, for instance–to OnCue’s database; specifically, to the Songs table. So I change the database description file (the “model”) to include “playCount” in the Songs table.

The model is what the app uses to create and read the database.

So the very first time you download and launch OnCue, it reads the model file and creates the database the way the model describes. Then every time it needs to change the database (to add songs, for example), it refers to the model to see where in the database to add the songs (and what information to include).

When I change the model to add “playCount”, and then release the update and you download and install it, OnCue attempts to open its database…

And that’s where the problem comes in. The database (which was created when you installed OnCue) doesn’t match the model in the update–i.e., now there is a “playCount” field in the model, but not in the database. An app can’t open a database that doesn’t match the model it’s trying to use.

To deal with this, I need to create something called a model map. It tells the app how to change (migrate) the old database to match the new model.

Unfortunately, I apparently never mastered this particular aspect of app development.

I change the model, then create the map and configure the migration. To test it, I delete OnCue from my iPhone and iPad and reinstall it directly from the App Store, so the version I have is the same as the one you have. Then I install the new version and see if the migration works.

I never submit the update to Apple if I know it’s not going to work. To the extent that I’m able to test it, it works fine and I assume it’ll work fine for everyone who installs it.

Of course, from all the emails I receive from users who report crashing after update, that’s obviously not the case. For some reason, some people have problems and others don’t.

There’s something in the migration that corrupts the database for some users. I don’t know why. I test and test and test and to me, everything looks just dandy.

So there’s the Why.

Now here’s what I’m doing about it: I’ve adopted a new tool to help me manage the database–MagicalRecord, if you’re curious–and a different type of migration style.

Hopefully, I can crush these issues once and for all.

I guess we’ll find out with OnCue 5.2.

Categories: bugs, oncue.

OnCue 5.1 submitted to the App Store

OnCue 5.1 has been submitted to the App Store for review. Among many bug fixes and feature improvements, OnCue 5.1 also features a completely redesigned iPad interface. Here’s a little preview:

Categories: oncue, updates.

In the works…

http://oncueapp.info/fbteaser/

Shhhhhhhhhhh.

Categories: oncue, upcoming features.

Super-secret sneak-peak at OnCue’s upcoming iPad interface

Shh!

 

Categories: oncue, Uncategorized.