Archive for 'iPhone'

URL Scheme Tidbits

Been a while since we noted anything much about URL scheme fun and games around here, ’tisn’t it? To refresh your memory, here’s a couple still worthwhile posts:

handleOpenURL.com mentions places to find databases of app’s URL schemes;

x-callback-url described an excellent initiative for standardizing those schemes.

But unfortunately, x-callback-url hasn’t been adopted all that widely so far. But with this new library you have no further excuse not to:

tapsandswipes / InterAppCommunication

x-callback-url made easy

Inter-App Communication, IAC from now on, is a framework that allows your iOS app to communicate, very easily, with other iOS apps installed in the device that supports the x-callback-url protocol. With IAC you can also add an x-callback-url API to your app in a very easy and intuitive way.

IAC currently supports the x-callback-url 1.0 DRAFT specification

If, on the other hand, you have complicated URL schemes that you’re not interested in supporting that with, there’s another new library for you too:

joeldev / JLRoutes

JLRoutes is advanced URL parsing with a block-based callback API. It is designed to make it very easy to handle complex URL schemes in your application without having to do any URL or string parsing of any kind.

  • Simple API with minimal impact to existing codebases
  • Parse any number of parameters interleaved throughout the URL
  • Seamlessly parses out GET URL parameters and passes them along as part of the parameters dictionary
  • Route prioritization
  • Scheme namespaces to easily segment routes and block handlers for multiple schemes
  • Return NO from a handler block for JLRoutes to look for the next matching route
  • Optional verbose logging
  • Pretty-print the whole routing table
  • No dependencies other than Foundation

Look like a good pair of candidates for a mashup, don’t they?

In other news, here’s a clever tip for using URL schemes to activate experimental facilities:

Letterpress 1.4 includes experimental support for Spanish. Type in “letterpress:experimental” in Safari on your device (or just tap that link) to enable the dictionary options. You can then switch the dictionary under More / Language…

We are definitely going to start exposing things like that in our apps. Debug-related functionality is a particularly fertile field; we can think of many occasions indeed when a command like “myapp:throwupdiagnostics” would have been mighty handy indeed to stick in a support reply.

And just to remind you of another clever URL scheme trick, checking to see if they’re handled is a good way of knowing if an app is installed, as demonstrated to slick effect in a Collect Them All Feature!

UPDATES:

Courtesy of @viticci, “People doing stuff with URL schemes:”

Convert Text Action

The URL Creation Workflow

iOS URL Schemes

Create A Local Evernote URL on the iPad with Pythonista

UTI definitions are another approach to the problem of data sharing: Using Custom File Types to import data into your iOS Apps

Open Source iOS Library Providing An In-App URL Router

Continue Reading →
1

Sequencer: Async Flow Control

Here’s a sweet library for getting rid of those annoyingly deeply nested block constructs:

berzniz / Sequencer

Sequencer is an iOS library for asynchronous flow control.

Sequencer turns complicated nested blocks logic into a clean, straightforward, and readable code.

Sequencer *sequencer = [[Sequencer alloc] init];
[sequencer enqueueStep:^(id result, SequencerCompletion completion) {
    NSLog(@"This is the first step");
    completion(nil);
}];
[sequencer enqueueStep:^(id result, SequencerCompletion completion) {
    NSLog(@"This is another step");
    completion(nil);
}];
[sequencer enqueueStep:^(id result, SequencerCompletion completion) {
    NSLog(@"This step is going to do some async work…");
    int64_t delayInSeconds = 2.0;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        NSLog(@"finished the async work.");
        completion(nil);
    });
}];
[sequencer enqueueStep:^(id result, SequencerCompletion completion) {
    NSLog(@"This is the last step");
    completion(nil);
}];
[sequencer run];

What does the above code do?

A Sequencer was created. There is no need to retain/hold-on-to-it. Trust me.

Four steps were enqueued to the Sequencer. The third step is async, but all the rest are plain sync code.

Each step finishes by calling completion() with a result object. This result is sent to the next step (in our case the result is nil).

We run the sequencer.

Note: Break the steps by just removing the call to completion(nil). Everything will be cleaned-up auto-magically.

Simple, elegant, and functional: What more could you ask for?

h/t: ManiacDev!

Continue Reading →
0

Review: Creating Games with cocos2d for iPhone 2

So as promised in our cocos2d survey a couple days back, we’ve been reading the latest from Packt,  Creating Games with cocos2d for iPhone 2:

9007OS_9007OS_Cocos2d for iPhone Hotshotcov.jpg.png

and why yes, we quite like the approach it takes. Most books we read go through pieces of a big project where the newbie finds themselves easily overwhelmed, or are snippets without a context so you need to be able to grasp their application on your own; what this one does is present nine complete but small enough to be easily graspable games of popular genres — and bundled them up to the App Store too, where you can check them out to see if you’re interested in seeing the code:

Pack 1 – Mole Thumper, Brick Breaker, Pool

Pack 2 – Memory, Match 3, Snake, Scrolling Shooter, Endless Runner

Pack 3 – Cycles of Light

The theory behind that is explained on the cocos2d blog here:

… Most developers learn the basics of cocos2d for iPhone v.2.0, and subsequently hit a wall. We have all these interesting classes that are really powerful, like CCLayer, CCSprite, actions, etc. How can we put these things together and make something equally interesting out of them?

That is the “gap” this book aims to fill. Rather than take the beginner’s book approach, where we spend several pages explaining what a sprite is, how it is drawn, etc. “Creating Games” skips many of the generalities and jumps right into the reason we are here: building games. This is the book I wished I had in hand when I was first exploring cocos2d for iPhone.

Class by class, method by method, the text explains the “good parts” of why we are building the code in this fashion. All the “good parts” are explained in detail: from building with Box2D to GameKit Bluetooth integration, and even how to build in “artificial randomness” into a Match 3 game, so you never run out of moves.

Each chapter is a complete game, and all source code is available as a download from the publisher’s web site. The games cover a wide variety of game types, and the games become more intricate and complex as the book progresses…

Can’t add to that really, except to observe that why yes the book is pretty much perfectly positioned to help cover that jump from reading the API to figuring out how to actually use it. So if you’re a complete newbie, we’d still recommend The iPhone Game Kit; but if you’ve got a bit of programming background but are new to cocos2d and/ot game programming, yep this is an excellent choice. Or if you’re interested in checking out the approach the author takes to the covered game genres, which are

  • Chapter 1: Memory
  • Chapter 2: Match 3
  • Chapter 3: Mole Thumper
  • Chapter 4: Snake
  • Chapter 5: Brick Breaker (with Box2D)
  • Chapter 6: Cycles of Light (iPad with Bluetooth integration)
  • Chapter 7: Pool (with Box2D)
  • Chapter 8: Scrolling Shooter (using Tiled)
  • Chapter 9: Endless Runner

One quibble you might have is that why isn’t v2.0 out of date already? Yep, but not by much, and download notes to bring it up to speed are on the author’s site. And while you’re there, check out the video. Definitely the best trailer we’ve ever seen for a programming book. (Pretty sure it’s the only trailer we’ve ever seen for a programming book, so the bar’s low there, but hey.)

So overall? Well, we like to reserve five stars for books that qualify as “absolutely essential fundamentals”, and it’s not quite that, but it is definitely a well done guide with far more coherence than you’ll find hunting down tutorials and samples on the web. Solid four stars, with the particular recommendation that if you find yourself in the position of being able to install cocos2d and run the samples but are having trouble gapping that over to getting started on your own game, this is the absolutely perfect book for you!

Continue Reading →
0

State of cocos2d Address: 2013

So just over one year ago we took a look at developments in the cocos2d world in the previous year while gearing up to review Packt’s latest book on the subject, and why look; we’re doing the exact same thing now! This year, it’s Creating Games with cocos2d for iPhone 2:

9007OS_9007OS_Cocos2d for iPhone Hotshotcov.jpg.png

… and in very short order we trust, we’ll have opinions for you on it!

Meanwhile, the most surprising — although in hindsight obvious — news of 2012 in cocos2d land was the announcement of the explicit refocus from iOS gaming to a cross-platform development suite:

… Our goal is to provide a complete toolchain for developing multi-platform games both for Web and Mobile, all the way from rapid prototyping to a finished high performing game. The main components of our stack are:

For the Web, we are using pure JavaScript code, while for Mobile we are using JavaScript on top of native engines for maximum performance…

Apparently 2012 was also a good year for altering common understandings of terms like “maximum”. But snarkiness aside, yes it’s pretty likely that many iOS-centric developers are willing to compromise as much as Zynga to improve cross platform development efficiency; so this is no doubt A Good Thing™ for them. Latest coordinated release as we type here was four days ago, release notes here.

On the other hand, if you understandably recoil in quivering horror at the thought of sullying your iOS-centric vision with accommodations to those other, lesser, platforms, then 2012 brought you the full blown fork “KoboldTouch”. That seems to be chugging along nicely as well so far.

Tools-wise, the landscape of essential goodies really didn’t change during the year aside from the anointing of CocosBuilder mentioned above, but keep your eye on Spriter and ArtPigEditor as possible supplements. This tools list from July looks still pretty much up to date, and of course the mothership’s Editors/Tools forum is always worth keeping an eye on. Oh, and when you get around to marketing videos, Kamcord looks pretty nifty.

On the learning resources side, the only brand new book of 2012 is the one above; but Mr. KoboldTouch brought out a third edition “Learn Cocos2D 2″, and our still #1 recommended getting started resource is The iPhone Game Kit, now updated for iOS 6 and cocos2d 2.0. ‘Course, soon as you get your feet wettish with those, you should head directly to RayWenderlich.com, who definitely wins the Internet as far as iOS tutorials go. Notable cocos2d posts/updates are

Other miscellaneous tidbits, tips and tricks from around the web (ok, mainly ManiacDev.com) of interest:

Example: Easily Creating Particles In Cocos2D That Can Both Fade In And Out

krzysztofzablocki / CCNode-SFGestureRecognizers – “a category designed to simplify adding UIGestureRecognizers support”

Exporting Flash Animations to Cocos2d Actions

Open Source: Library For Importing Flash Animations Into Cocos2D iOS

Tutorial: How To Easily Create A Cocos2D AI Controlled Actors With A Finite State Machine Compiler

Example Source Code: Easy Cocos2D Sprite Floodfill Class

List of Open Source Cocos2d Projects, Extensions and Code Snippets

18 Tools and Source Code Components for Cocos2D iOS Game Development

Tutorial: How To Make Jagged Drawn Lines Smooth In Cocos2D

How to Zoom In on a Cocos2D Node

Example: Open Source iOS Castle Destruction Game Using Cocos2D And Box2D

Cocos2D and Storyboards

nerdcave / PESprite – “a CCSprite extension for cocos2d that supports collision detection”

CloudBomber – Cocos2D deformable terrain example project

Pixel based destructible ground with Cocos2d

A Magnifying Glass for Cocos2D

Open Source Cocos2D Based Framework For Creating Highly Interactive iPad Books

Building a depth map for cocos2d in Photoshop

Tutorial: Build An Angry Birds Style Game Quickly W/Cocos2d, LevelHelper and SpriteHelper

sceresia / CCAutoType – “cocos2d-iPhone class to add RPG-like auto typing dialog”

Simple Fractal terrains [in] cocos2d

Tutorial: Create A Character With Ragdoll Physics Using Chipmunk And Cocos2D

Strategies for Accessing Other Cocos2D Nodes In The Scene Hierarchy

The Four Ways of Implementing a Scrolling View with Cocos2D Explained

Example: Displaying A 3D .OBJ Model In Cocos2D iPhone v2.x (W/Zooming, Rotation, And Movement)

Example: An Open Source iOS Pokemon/Pet Type Game Created Utilizing Cocos2D

UPDATES:

Open Source Pinch To Reveal Animation using Cocos2d

Continue Reading →
1

STTweetLabel

This is certainly conveniently timed; yesterday they decided they’d like player names to be tappable to bring up the player’s card everywhere they’re displayed in Atimi’s sports apps — and why look, today we have an example of just how to go about that!

SebastienThiebaud / STTweetLabel

A custom UILabel view controller for iOS with certain words tappable like Twitter (#Hashtag, @People and http://www.link.com/page)

screenshot.png

h/t: iOS Dev Weekly!

Continue Reading →
1

CMUnistrokeGestureRecognizer

Ever tried to write a UIGestureRecognizer? Kinda hard, wasn’t it? Well, check out CMUnistrokeGestureRecognizer:

How would you go about recognising a gesture like this star shape in an iOS app?

star_gesture.png

This was the problem posed to me recently while working on a project … Created by three clever chaps at the University of Washington back in 2007, the $1 Unistroke Recognizer was designed to recognise single path (unistroke) gestures, exactly what I was looking for. Not only that, but design goals for the technique make it an ideal candidate for use in mobile applications…

CMUnistrokeGestureRecognizer is my port of the $1 Unistroke Recognizer to iOS. I’m not the first to implement this recogniser in Objective-C but none of the existing implementations met my requirements. I wanted the $1 Unistroke Recognizer to be fully contained within a UIGestureRecognizer, with as simple an API as possible.
So the CMUnistrokeGestureRecognizer implements the $1 Unistroke Recognizer as a UIGestureRecognizer. It features:

  • Recognition of multiple gestures
  • Standard UIGestureRecognizer callback for success
  • Template paths defined by UIBezierPath objects
  • Optional callbacks for tracking path drawing and recognition failure
  • Configurable minimum recognition score threshold
  • Option to disable rotation normalisation
  • Option to enable the Protractor method for potentially faster recognition

Looks like just the thing for adding complex gesture support into your apps, doesn’t it now?

h/t: iOS Dev Weekly! (Yes, we just read the Dec. 14th issue. Getting back up to speed, slowly…)

Continue Reading →
0

UI Screen Shooter

This is an interesting — and handy! use of UI Automation:

jonathanpenn / ui-screen-shooter

This is a set of scripts to demonstrate how to take screen shots for your iOS app for the App Store automatically using UI Automation. It shows how to take screen shots, extract them from the automation results and change the language in the simulator with shell scripts. This saves quite a bit of time since we need to generate screens for the 3.5″ display, the 4″ display, and both iPhone and iPad if your app is universal–not to mention that you have to do this for every localization you support in the store.

You can see the script run against one of my apps in this video

Some more handy UI Automation tips here.

h/t: iOSDevWeekly!

UPDATES:

Automating iOS App Store screenshots

Continue Reading →
0

Tips: Auto Layout

Had some … issues … getting iOS 6 auto layout to work quite the way you expect? Nope, you’re not alone.

Screen Shot 2012-11-29 at 6.49.38 PM.png

Here’s a couple posts with some helpful tips:

Auto Layout & Interface Builder Tutorial: Solving some common problems

IB has a few quirks (some would say large number of flaws) which can make it seem like black magic trying to bend it to your will…

Issues With Achieving Auto Layout Zen

I’ve had better luck trying to read women in my failed relationships than trying to debug why my constraints aren’t working out…

Tip: Manually Adding iOS 6 Auto Layout Constraints

Tip: Ambiguous Auto Layouts in iOS 6

If you haven’t really got into this auto layout thing yet, the best introductory tutorials are at raywenderlich.com, exactly where you would expect by now:

Beginning Auto Layout in iOS 6: Part 1/2 and Part 2/2

And finally, if you think this auto layout stuff sounds kinda nifty but are stuck targeting iOS 5, might want to take a gander at

RolandasRazma / RRAutoLayout

RRTestApp has constraints based layout and all constrains added in interface builder like you normally would do for iOS6, whats interesting is that it has deployment target iOS5. You can run same project on iOS6 and iOS5 and it should look and behave (when rotating) the same. Essentially its iOS6 AutoLayout) back port to iOS5…

UPDATES:

iOS Autolayout: Fun Facts and Tips

iMartinKiss / KeepLayout: “Making Auto Layout easier to code.”

How Much, or How Little, I Use Interface Builder These Days

⌘⇧ – Command Shift series:

dkduck / FLKAutoLayout: “is a category on UIView which makes it easy to setup layout constraints in code.”

10 Things You Need To Know About Cocoa Autolayout

Continue Reading →
1

App Store Rankings

This looks like a nifty tool for your App Store SEO efforts:

App Store Rankings is the keyword based App Ranking Tracker

Are you still manually checking your app’s rankings? Are you searching every day to see how well your app ranks for your keywords? It’s time to upgrade to App Store Rankings and let us track all your keyword performance for you. Get accurate keyword results, historical data, alerts and more.

Keyword Based App Ranking Tracking

The majority of all app downloads happen when users search for apps. That’s why tracking your ranking and performance for all the keywords that matter to your app is very important. App Store Rankings automates this task, turning the pain of searching and tracking your rankings across dozens and hundreds of keywords into an easy task…

keyword-table.jpg

Yep, that’s a pretty darn convenient presentation, isn’t it now? Pricing seems reasonable, and there’s a single app free plan for a taster too.

Be sure to check out the App Store Rankings Blog as well, there’s some pretty interesting posts there. Particularly the one from October 28th. Modesty prevents us from explicitly (heh) describing why, but check it out for some fascinating quirks of app search that you weren’t aware of … at least, we very sincerely hope you weren’t aware of!

Continue Reading →
1

NFC for iOS: FloJack

So you really wish your iOS device was NFC enabled? And don’t feel like waiting around for Apple to bother supporting it? Well, you might want to help nudge this Kickstarter project over the top:

Screen Shot 2012-11-25 at 9.39.55 AM.jpg

As we write they’re some $4K short of their $80K goal with 34 hours to go; the Flomio website is here where you can see the team includes the dude who wrote NFC Quick Actions for Android, and you can check out their SDK at flomio / flojack-ios; so it certainly looks like they’re serious here, and it would be nice to see their project succeed … if only to cut off another talking point from those cackling “ANDR0ID FTMFW!” fandroids. Cheap at the price, really.

h/t: [mobile developer:tips];!

Continue Reading →
0
Page 2 of 91 12345...»