Archive for the ‘iPad’ Category

iOS Simulator and Documents folder

Sunday, August 4th, 2013

Note: This only applies to Xcode 5 and earlier. Xcode 6 rather radically changed the location of the app and its associated data folders.

This is geared to the iOS developers or project managers who might be testing builds with the simulator out there…

Recently, my client wanted to check out wow their currently shipping app would look under Apple’s new iOS 7. Since they did not have iOS 7 installed on any of their testing iPads, they wanted to run the latest code base under the simulator. Their app requires some files in the Documents directory to be at useful, so the question of how to populate it with test data came up. Here is the skinny:

Overview

When you are developing an application for iOS, I would guess that a majority of the time (except in certain situations) you will be relying on the iOS Simulator (it is actually named “iPhone Simulator”, but it covers all the iDevices, so whatever). If for no other reason than the code-compile-debug cycle is much faster. But what if your application works with external files stored and transferred in and out of the Documents directory?

From here on out, we are going to assume a bit of familiarity with Terminal.app. If you are a developer and don’t have experience with Apple’s command line terminal application, we keep it fairly simple, but you really should become familiar with it. Please launch it now. You will find it in /Applications/Utilities/.

Find The Way

So, when Xcode runs your application in the simulator, where does it live? Here:

~/Library/Application Support/iPhone Simulator/<iOS version>/Applications/

Where <iOS version> might be “6.1” or some what ever (well pretend at this date and time we are referring to 6.1, but it would be the same with any version). If we get a directory listing (ls command), we should see something like:

Screen Shot 2013-07-26 at 1.25.54 PM

Here we see 7 different entries, each corresponding to a different application (your listing may have more or less, depending on how many different projects you have going at one time). When the application is launched in the Simulator for the first time (or after a “Reset Contents and Settings…” from within the simulator) Xcode creates and associates an Unique IDentifier (erstwhile known as UID) with which to name the directory for the application bundle and to track the application from within the debugger.

As you might expect, this makes it slightly challenging to find your app. Sometimes, using the ls -l command will give us the additional information we need (namely, date of the creation for the directory), from which we can determine our desired directory.

Screen Shot 2013-08-04 at 7.02.44 PM

Otherwise, we can do:

ls ~/Library/Application Support/iPhone Simulator/6.1/Applications/*

and examine the results to see which contains our application (looking for MyApp.app). You should see each of the above directories (with UID naming) plus their contents listed beneath each.

Screen Shot 2013-08-04 at 7.03.56 PM

Copying

OK, so now we know our path to our target iOS application. From here on out we’ll use 05EF4BB0-A995-99C1-067752EAD15B as our example UID. The path to this applications’s Documents directory will appear as such:

~/Library/Application Support/iPhone Simulator/6.1/Applications/05EF4BB0-A995-99C1-067752EAD15B/Documents/

Now we’ll employ the services of the Unix command cp (for copy) in the Terminal:
cp -v /path/to/file or files/we/want/copied/* ~/Library/Application Support/iPhone Simulator/6.1/Applications/05EF4BB0-A995-99C1-067752EAD15B/Documents/

Translated this is telling the system: copy all the files in the source directory to our simulator app documents directory. The ‘-v” tells cp to report each file copied, so you can leave this option off if you like.

If you prefer to use the OS X Finder to drag-and-drop copy files, then simply issue the system command

open ~/Library/Application Support/iPhone Simulator/6.1/Applications/05EF4BB0-A995-99C1-067752EAD15B/Documents/

And a new window will be opened with connected to the Documents directory.

I hope this helps.

iOS: UIMenuController

Tuesday, June 12th, 2012

File this one under: For my own future reference.

UIMenuController was introduced as public API in iOS 3.0 (along with UIPasteboard and Copy and Paste functionality). This is now a technology we take for granted in the iOS world, but it really wasn’t that long ago that Apple hadn’t provided this seemingly basic service.

Recently I was using this API in DeepDish GigBook to update some fairly crufty workflow. I am not going to explain how to use UIMenuController, as the documentation is fairly straight forward. What I will mention is a few “gotchas”.

1. There is no target for an UIMenuItem.

It is whomever is the First Responder. In other words, your controller class probably (in most cases) is what will handle the actions, so you want to make sure it can become the first responder. Add the following to your controller implementation:

- (BOOL)canBecomeFirstReponder
{
    return YES;
}

IF you don’t do this, then passing the message -setMenuVisible:animated: to the UIMenuController will have no effect.

2. Implement - (BOOL)canPerformAction:(SEL) sender:(id) in your controller:

There is little reason not to, and many reason why you should. This will be implemented in the same controller that also implemented -canBecomeFirstResponder. This will allow you to enable or disable (effectively hiding) any menu options you may or may not want at any particular time. It avoids having to recreate the menu items list every time the user invokes your menu through whatever gesture.

- (BOOL)canPerformAction:(SEL)action sender:(id)sender
{
    if ( action == @selector(myMenuItemMethod:) ) {
        return YES;
    }
    else if (...) {
        return ...;
    }
    else {
        return [super canPerformAction:action sender:sender];
    }
}

Of course, there might be situations where the same view might support different menu configurations depending on some context, in which case you probably do need to rebuild the menu list each time. But in case where you don’t…

3. Remember that your menu items are persistent:

Whatever menu items you add will remain there until they are set again. If you think about it, this makes sense since UIMenuController is a singleton.

This one bit me due to two reasons. 1) I didn’t have -canPerformAction:sender: implemented, 2) I assumed that menu items list must be rebuilt prior to each invocation of the menu. What happened was a different subview was presented within the main view of the controller, and the subview contained an UITextView. When the user double tapped the text view, and had some text on their pasteboard, the Paste menu option was displayed, along with the other menu options already installed by an earlier menu displayed in the same view. Oops.

The first solution was to nil out the menuItems when the menu was dismissed. This seemed a bit of hack. The better solution was to follow item 2 above since my menu items never changed as long as I was in this particular view. In this case, since a subview only required the basic Copy, Cut, Paste, Select, Select All, etc. the controller would return NO when the controller itself was no longer the first responder. Revisiting our implementation of -canPerformAction:sender: from above:

- (BOOL)canPerformAction:(SEL)action sender:(id)sender
{
    if ( action == @selector(myMenuItemMethod:) ) {
        return [self isFirstResponder];
    }
    else if (...) {
        return ...;
    }
    else {
        return [super canPerformAction:action sender:sender];
    }
}

Cheers!

What’s Happening

Wednesday, June 6th, 2012

It’s been quiet on the Wooly Blog front. Too quiet.

To be honest, it is because we spend our days writing code and not writing prose. But, communication is key, and everybody wants to know their favorite Wooly company is still alive and kicking.

We have noticed that Wooly Tasks is a bit long for an update. All I can say is that a pretty nice update is in the works. What to expect:

  • New task management engine to more efficiently and reliably track and manage the tasks.
  • Printing and Twitter support (paid version only)
  • New UI layout to show the most important information quickly, and additional details when you desire them.
  • On iPad, removed hideous paper pad background. It wasn’t our finest moment.
  • iCloud integration and synching between devices (paid version only).
  • Stability enhancements (ok, we fixed some bugs).

On the Wooly Wind Chill side of things, we are looking into being able to integrate your favorite weather source for tapping into current temperatures and wind speeds. The first version will roll out with just a couple, and subsequent versions will add more.

On the contracting front. We are still helping Deep Dish Designs make their wonderful iPad Music application, DeepDish GigBook. While we can’t state specifics, we do know a new version with some very useful enhancements (do we sound a bit biased?) that both companies worked hard on putting together will come out “soon”. Current shipping version in the App Store is 1.6.2, so when you see a version number greater than that, then that “soon” time has arrived.

Speaking of iOS contracting services. If you have a funded product idea that you want Wooly Beast Software to help you bring to market, please feel free to contact us at info@woolybeastsoftware.com.

Finally, after considerable discussions with management, we have embarked on an exciting new project. In this post, we will not go into a lot of details of what it is, because there are still some things to work out at our end. However, we can say it will involve a bit of this: 

and this:   

and a whole lot of these guys:

That’s about it for now. Next installment we’ll discuss a bit more on what’s going on with our new project, and chronicle the steps up to release.

 

WWDC 2011 Keynote

Monday, June 6th, 2011

No, I’m not there. :-( As of the time of this writing (9:30am WWDC time), the energy is palatable for this year’s event even 600 miles north of San Francisco (one of my all time favorite places to be) up in Portland.

We already know that Lion (Mac OS X 10.7) will be “announced” (it already really has been, just not the minutia), iOS 5 (same…it exists, no real details), and iCloud (more heavily covered…ie streaming music and a music locker, but free MobileMe services too?). What we don’t yet know is what the “Just one more thing…” is all about.

We know there is something afoot due to this image taken inside Moscone West this morning: (image no longer available)

I originally speculated with @CocoaGeek that this might just be the banners seen already that read “Lion + iOS 5 + iCloud = WWDC11″. However, as @CocoaGeek correctly pointed out to me, this doesn’t make a lot of sense since those have already been announced, even if no details have been given.

So, at 10:00 am (WWDC time) we’ll begin to know that all this is about. All I know is that 2011/2012 is going to be very, very good years to be an Apple developer.

Will update as more information flows in….

10:00 am update…

Mac OS X Lion “announced’ along with 10 new features (out of a claimed 250) being showcased:

  1. Multitouch gestures with trackpads
  2. Full screen apps (meant for smaller screen laptops/devices)
  3. Mission Control (kind of like Exposé + Spaces). A simple gesture gives you a bird’s eye view of everything on your system.
  4. Missed this one…will add it once I can get the skinny on it. Ah, I guess it was the Mac App Store. Nothing terribly new, other than it has become the number one channel for buying PC software.
  5. Launchpad, a new launcher a’la iOS Springboard for the Mac OS. Apparently also employs a sandboxing scheme.
  6. Resume (Nice!) allows you to return to the exact state of the app and its documents
  7. Auto Save (enough said)
  8. Versions… version control for everyone (I wonder if it is based on Git? :-)). Time Machine for all your documents. Who doesn’t want/need that?
  9. AirDrop (Yes!) peer-to-peer WiFi based network (what?! No bluetooth love!?)
  10. Mail.app with updated UI and other enhancements.

Available only via the Mac App Store, and only $29.99!! Wow!

10:34 am update…

OK, that’s the 10 features they chose to show-case. Looking forward to hearing what is in iOS 5. iCloud being saved for last, so I expect great things. Plus, don’t forget our “One last thing…”

iOS 5 Top 10:

  1. Notifications. Yes! This was a mess and very intrusive. Now can swipe down from top to see current list of notifications.
  2. Newsstand, iBookstore for magazine and newspaper publishers. Nice idea. I wonder how many Indie developers this impacted?
  3. Twitter integration! OK, wow. Explains a few moves made by Twitter over the past few months, particularly with authentication and third-party app support. Again, how does this impact the Indies?
  4. Safari (updated). Reader support (as can be found in Safari 5 for Mac), very nice. Reading List, for saving for later. Tabbed browsing, on the iPad anyhow (Excellent!).
  5. Reminders (Hmmmm… Wooly Tasks killer I think). Lots of interesting features that I had also thought of adding, but Apple has 1000s of more engineering resources than I do, so they beat me to the punch. Ah, the nature of the business. We’ll see.
  6. Camera (updates). Lots of enhancements, mostly in making taking a picture faster and easier. Using the up volume button to take a picture will be really nice. Rule-of-thirds guides. Built-in editing of photos.
  7. Mail (updates). More composing and editing options, in particular, rich-text formatting (YES!). Introducing a new keyboard layout that is thumb-centric and available system-wide.
  8. PC Free…no more tethering!
  9. Game Center
  10. iMessage, new messaging service for all iOS devices. Yay! iChat for iOS

AirPlay mirroring.

iTunes syncing wirelessly.

Available Fall 2011.

11:20 am Update…

iCloud. The Digital Hub that Steve Jobs talked about in 2001 has now moved to “the clouds”. iCloud stores your content “in the cloud” and wirelessly pushes it to all your devices.

MobileMe “wasn’t our finest hour”, but “we learned a lot”. MobileMe is dead. iCloud will subsume all the services of MobileMe, but everything is rewritten from the ground up, and the best news of all…

…it’s FREE.

iCloud is invisibly integrated into apps that need synching of data, such as Mail, Contacts, Calendar, etc. Wireless back-up (a’la “PC Free” feature above). Also backup purchase of iBooks, music, apps, camera roll (on iPhone), etc.

iCloud also has a feature called “Documents in the Cloud” for syncing Pages, Numbers, and Keynote documents. For developers, there will be an iCloud Storage API. And, it will work with PCs as well.

iCloud allows photos taken on your iPhone to automatically be synched onto your iPad. No more needing to tether, sync, sync, sync, … Up to 1000 images stored on your iOS devices, and anything you want to permanently keep, you just need to move into an album. Photos remain for 30 days, so grab them or lose them. There is a Push Photo Stream builtin to camera rolls which is where the syncing takes place.

iCloud is WiFi only due to immense amount of data being pushed. When carriers can reliably offer 4G or greater, then I’m sure it will move to the celluar network.

Finally, there is now iTunes in the Cloud. Buy a song, sync with all devices, automatically.

10:50 am update…

Just in time for “One more thing…”

iTunes Match. For those songs that you ripped from your personal CDs. iTunes will scan your music for non-iTunes purchased music, and voila, your songs are automatically in the cloud. No uploading needed, if they already exist in the iTunes Store. For the rest, they are uploaded. This is the rumored “Music Locker”, and it costs $25 a year (but if you had MobileMe, you still $74 ahead).

 

 

Tapworthy: The Essential iPhone Developer’s Book

Monday, August 2nd, 2010

“Tapworthy: Designing Great iPhone Apps”
by Josh Clark
http://oreilly.com/catalog/9781449381653
O’Reilly Media
320 pages
$39.99 dead-tree book
$31.99 digital book (look for periodic discount codes on http://oreilly.com)

Usually, when I seek out a technical book, I tend to look at what O’Reilly has to offer on the subject first. I have always found their books to be both informative, and usually actually fun to read… generally not an easy feat when it comes to technical subjects. Josh Clark’s recently published book, “Tapworthy: Designing Great iPhone Apps” continues this fine tradition.

After you have read Apple’s iPhone Human Interface Guidelines (usually referred as “HIG“), before you write a single line of code, and even before you start designing that next great app, take a short amount of time to read “Tapworthy”. It is a blend of philosophy, pragmatism, and enlightening First Person views into the development thought process of developers of some well known iPhone apps, including Twitterific, Gowalla, PCalc, and USA Today.

Note: Even if you are not writing an app targeted at the iPhone, but some other mobile platform, such as Android, WebOS, or Windows 7 Mobile, don’t let that deter you from reading this book. Apple went to a lot of trouble researching human interactions centered around the mobile form factor, and Mr. Clark brings much of the findings into the topics he covers. It won’t mean you’ll be writing an iPhone clone app, but an app that follows some logical, and reasonable, guidelines that will make the user experience that much better.

While I often tend to skip a books’s Introduction, don’t skip it in this book. The last section, “Advice from the Real World”, is worth half the price of the book alone. Copy this page and hand it to any prospective clients that come knocking at your door asking you to do their killer iPhone app idea, to give them a reality check on the time and effort to do it right:

Great apps seem effortless, and the best make it seem as if the design process came fast and easy. That’s rarely true. No matter how sensational the designer or developer, designing a great app takes hard work and careful consideration.

The first three chapters, “Touch and Go”, “Is It Tapworthy?”, and “Tiny Touchscreen” were the most thought provoking of the chapters, and are applicable to any small mobile platform. Here is where the philosophy of mobile app usage and development is addressed. As any good book, these chapters set up the basis for the remaining chapters where it is applied discussing the various flavors of content navigation models, controls indigenous to the iPhone, and general product presentation tips. The themes “Less is More”, and “Focus, focus, focus” emerge, and Mr. Clark’s helpful guidelines of, “Rule of Thumb”, “The Magic Number is 44″, and “Designing to a 44 Pixel Rhythm” all stand out and will go a long ways in helping the developer create an app that is not too busy, too crowded, or too difficult to use.

The remainder of the book covers the material that is found in Apple’s HIG documents, but in no way should it be considered a substitute, nor should it be passed over. On the contrary, they should both be read together, as they compliment each other. “Tapworthy” has many little gems sprinkled throughout these chapters that makes even an experienced developer think, “Ah ha!”. Subtle nuances of proper usage for various UI bits, working with gestures, working well with other apps, and general presentation. “Tapworthy” gives the “when” and “why”, whereas Apple’s HIG gives the “what” and “how”.

I thoroughly enjoyed reading “Tapworthy”. I find the end of chapter summary “Touchpoints” useful for returning back to refresh one’s memory on key concepts after having completed the book. The various diagrams used to help illustrate key points throughout the book were very helpful, although iBooks had some formatting issues. However, only once did I have to go to my physical iPhone to get an visual clarification. Each chapter was sure to contain a few little morsels of information that I could step back and apply immediately to my current project (even though it is for the iPad). I will certainly go back and review old shipping apps and apply retroactively as appropriate.

I particularly appreciated the interviews with other developers. Where it could have been a big ego-fest for them, in actuality each was enlightening and illuminating, and in some cases humbling as they revealed their early failings and missteps. While you might not 100% agree with their design decisions, you can understand where they were coming from.

I rate this book as a must read for any iPhone developer or prospective developer. Of particular value are the Introduction, and chapters 1 through 3, to any mobile app developer, iPhone or otherwise. I think it will be the rare developer that won’t learn something from this book that will make their product(s) that much better. At the very least, a developer will have a much better understanding of basis of various Human Interface Guidelines requirements that were conceived and established by Apple.

Once again, O’Reilly has published a book that broaden my knowledge and was compelling to read. I look forward to seeing if Josh Clark will come out with “Touchworthy: Designing Great iPad Apps” in the future. You hear it here first, folks.

This book, and this book review, was entirely read and written on an iPad using Apple’s Pages, then posted to this blog via the WordPress iPad app.

iPhone OS 4.0

Thursday, April 8th, 2010

Way to go Apple! Nice major OS update! Today, Apple took the wraps off of iPhone OS 4.0. There are a lot of additions to this version, some strictly interesting to the user, and many very interesting to developers. Without a doubt, the iPhone OS has taken a quantum leap forward, and shows that Apple is not resting on their laurels.

Suffice it to say, the next time you hear or read about how another smartphone OS developer is going to put the hurt on Apple, just remember how Apple responded with this stellar (soon to be) release of the OS. Innovation is live and well at Apple.

Some notable highlights as we see it. More later I’m sure after we get our hands on what is available to us as developers.

Multitasking: Enough said. Thank you Apple.

Calendar Access: Finally we can gain access to the calendar, which should make for a more powerful experience when we incorporate that into Wooly Tasks.

Local Notification: Like Push Notification in 3.0, this is local to the user’s iPhone. What does this mean? Finally we can resurrect alarms in Wooly Tasks, among other things!

Folders: Did you know you could only install 180 apps onto your iPhone? Actually, less, since you have several Apple supplied, permanent apps. Now you can organize your applications into folders, and be able to store 2160 apps on your device. Nice.

Game Center: Incorporating built-in social gaming network. Leaderboards and “matchmaking” to hook you up with other players. Why is this interesting to us? See our motto. ;-)

That’s all for now. We are extremely excited to get out hands on the developer preview of OS 4.0, and really pick apart what it provides and plan for adopting the technologies. It is a very exciting time to be a user of the iPhone, iPod touch, and iPad, and even more exciting as a developer for the platform.

Cheers!