Posts Tagged 'iPhone'

Tip: Xcode 6 Bundle Signing

Having this problem with your shiny new Xcode 6 GM?

Screen Shot 2014-09-10 at 8.12.00 AM.png

Problem also discussed here.

Solution 1:

Adding the `–deep` flag to “Other Code Signing Flags” (OTHER_CODE_SIGN_FLAGS) got me around this.

Solution 2:

Delete Info.plist inside the bundle if it’s only a resource package.

(And if there’s some reason you need it, at least delete the ‘CFBundleExecutable’ key.)

Good luck with that!

Continue Reading →
0

Layout Best Practices

Read of the day while you’re nervously waiting to see what will need panic rewrites tomorrow:

Screen Shot 2014-09-08 at 8.33.11 AM.png

Don’t think there’s anything in there actually covered by NDA at this point, but we’ll just refer you there for the beta software feature discussion bits. The important parts are not new, but they’ve been widely disregarded to date, at least they sure are in software we get stuck maintaining:

  • Nowhere should you be using screen or window size to do layout. Your view bounds should be the only consideration.
  • At load time, as called out above, you’re not in a hierarchy yet. Therefore you do not know what your view bounds will be. This has always been a thing for any view contained by a view with its own layout, and became more of a thing with iOS 7 when your views developed an inclination to jump under the status bar behind your back, but rumour has it that it will be a big thing very soon.
  • layoutSubviews is the best place to be putting your legacy-type frame setting code.
  • updateViewConstraints is the correct place to figure out your interface for reals; if you’ve so far avoided auto layout, now is a superb time to get on that.

Hopefully none of this is any particular news to you, so getting all those legacy codebases copacetic with whatever novel execution environments actually appear tomorrow from the collection of swirling rumours should be no problem, right?

Continue Reading →
1

Standards Marked Downer

Here’s an interesting case study on how to not make friends:

Standard Flavored Markdown

It took a while, but I’m pleased to announce that Standard Markdown is now finally ready for public review.

standardmarkdown.com

It’s a spec, including embedded examples, and implementations in portable C and JavaScript. We strived mightily to stay true to the spirit of Markdown in writing it. The primary author, John MacFarlane, explains in the introduction to the spec

Well, that all sounds well and good, aside from having a snicker at the obligatory xkcd 927 mention, doesn’t it? Um, no. After not too many yay! great! finally! comments on the above, we start getting

… We all use Markdown, not just you and your pals. It isn’t yours to do with as you please. Create something new, and respect prior art…

… Besides that, the hubris involved in calling your fork standard is a bit much…

… any such effort needs to do so under a new name. Not to do so is confusing to users and needlessly hostile toward John Gruber…

… Ignoring this term means you’ve broken the deal, and opens you up to a copyright infringement lawsuit…

Oops. The comments devolve from that last point into wrangling over the legal definition of ‘derivative’ … but if you’re down to arguing on that level, well, you’ve already lost, haven’t you?

Screen Shot 2014-09-05 at 2.59.35 PM.png

… yeah, that’s a pretty darn good example of exactly the kind of reaction you want your new project to avoid at all costs.

Now, we generally try to actively avoid pointless drama like this — what led us to this donnybrook was actually a handy looking new pod

laptobbe/TSMarkdownParser

TSMarkdownParser is a markdown to NSAttributedString parser for iOS implemented using NSRegularExpressions. It supports many of the standard tags layed out by John Gruber on his site Daring Fireball. It is also very extendable via Regular Expressions making it easy to add your own custom tags or a totally different parsing syntax if you like…

which looked like a particularly nicely lightweight way to manage some easy attribution of strings. ‘Course, there’s lots of other implementations around too, if that particular one isn’t adequate to your needs. Or you could always start your own flavour. “Definitive Markdown”? “Authoritative Markdown”? Those aren’t taken yet!

UPDATES:

And the first attempt was to try “Common Markdown” and that didn’t work either … so now it’s CommonMark!

Continue Reading →
0

Tip: Open Settings URL

Oops, we managed to miss this in the WWDC videos:

Open Settings URL

A quick tip I picked up from WWDC 2014 session 715 on User Privacy. Starting with iOS 8 there is now a settings launch URL to send the user directly to the settings for an App. The code snippet below will do the trick:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
UIApplicationOpenSettingsURLString]];

If you’ve got any functionality that the user can say no to, it’s guaranteed they will, and then they’ll send you angry letters and one-star reviews when it doesn’t work, you’ve all been there right? So make sure you put on your iOS 8 upgrade checklist putting in a helpful remediation option wherever deniable things can fail!

Continue Reading →
0

Storyboard Launch Images

So, you been fearing what the likely new @3x sizes are going to do to your seven and counting launch image requirements?

Well, looks like all that fuss may be going away soon:

Replacing Launch Images with Storyboards

An Interface Builder-Based Launch Screen

In Xcode 6, there is another option. You can specify a storyboard whose initial view controller will then be used as the appʼs launch screen. This is how:

  1. Create a blank storyboard file named LaunchScreen.storyboard.
  2. Go to your target settings and, on the General tab, select the storyboard as your Launch Screen File. Xcode will add a corresponding UILaunchStoryboardName key to your appʼs Info.plist. When this key is present, Xcode will prioritize it over any launch images you might have set.
  3. Add a view controller scene to the storyboard. Add some subviews to the scene and position them with constraints. When you launch the app on a device, the OS should use the scene as the launch screen.

One Storyboard for All Screen Sizes

You can use the new adaptive UI features in Interface Builder to fit your layout to different screen sizes. If your scene requires screen-size-specific images, use asset catalogs to define different images per size class. Note that you can not only adjust constraints for different size classes, you can also remove selected views from a specific size class entirely by deselecting the Installed check box. See WWDC session 411 for details.

Also Works with NIBs

Despite the name of the UILaunchStoryboardName key, this also seems to work with NIB/XIB files containing a single view. When you open such a XIB file in Xcode, the File Inspector displays a check box named Use as Launch Screen, which is not there for storyboards…

There’s a number of partially-implemented caveats at the moment, but looks like a solid reason to get up to speed on those new adaptive UI features, because as they say

Screen Shot 2014-08-30 at 9.00.52 PM.png

Speaking of which, here’s a handy UICustomResolutions extension for UIWindow to help testing that!

h/t: iOS Dev Weekly!

UPDATES:

Yup, it’s 667×375@2x(1334×750) and 414×736@3x(2208×1242) just as predicted, and new @3x icon sizes to match!

As for xib/storyboards, they’re required for the new devices:

You use a launch XIB or storyboard file to indicate that your app runs on iPhone 6 Plus or iPhone 6.

Oh, wait no: You can also add raster images to the new LaunchImage.xcassets buckets.

Continue Reading →
0

Affilate API: Uber

Got an app with a map? This might be of interest to you:

Introducing The Uber API

As of today, we officially open—to all developers—access to many of the primitives that power Uber’s magical experience. Apps can pass a destination address to the Uber app, display pickup times, provide fare estimates, access trip history and more.

Note that ‘more’ does not currently include ‘actually call for a ride or anything’ though,

What about requesting a ride? Yes, we’ve implemented that endpoint as well, but because calling it immediately dispatches a real driver in the real world, we’re releasing it in a more controlled fashion, starting with a small set of partners. Stay tuned for more on that, and please let us know if you’re interested in being added to the whitelist.

OK then. So what’s in this new Affiliate Program for us exactly?

  • Offer your users credit toward their first Uber ride when they sign up via your app
  • Earn $5 (USD) in Uber credit for every new rider
  • Receive credits that never expire in your Uber account every month
  • Build something amazing and get your app featured on our site

Gotcha. Free rides! That’s awesome! Oh, no, wait … no it’s not. Not if you hang in Most Livable City #3:

Uber Has Expanded to 130 Cities, Vancouver Remains Only One It’s Ever Had to Back Away From

Oh, wait more … no, it’s really not.

This program is currently available to developers in the US only.

Well, that’s not rocketing up our priority list then. But hey, if you are a U.S. developer with a map-using app, something you probably want to consider!

UPDATES:

Open Source iOS Component Providing A Stylish View Connecting Your App To Uber

Continue Reading →
0

Airship Pushing Us Overboard

So it’s been a seriously long time since we looked at APNS providing options, as it’s been the universal default for everyone we’ve worked with since to default to Urban Airship. And, generally, to be perfectly satisfied with their free level of service. Turns out they’ve had enough of us freeloaders:

We’ve discovered that we work best when we’re working closely with our customers to help them solve their problems and implement a mobile-first experience for their users with our complete solution. [Ed. – why, what a polite way to say “getting paid”!] Today, we’re taking some concrete steps toward crystallizing that focus by sunsetting our free Developer Edition product that offers a subset of the capabilities of our complete solution.

If you are using the Developer Edition offering, everything will remain the same for the next six-months until its retirement on December 31, 2014. Between now and then, Developer Edition users can either choose to establish a paid relationship with Urban Airship for access to our push-only product or our full solution suite, or migrate to an alternate solution…

Well, these days when less than half opt in to pushes at all, it’s pretty hard to make a case for that for most of our Airship usage. So let’s see what options there are in the “migrate to an alternate solution” space for the freeloading indie, shall we?

In the messaging-focused provider category:

Appoxeestarts at $500/month

Boxcar — 200 pushes per minute to 100 devices for free; goes up by ppm

Element Wave — unlimited to 5K users for free; trial-only for more

Moblico — trial accounts only

Push IO — trial accounts only

PushApps — 1M pushes to 100K devices from 5 apps for free; notably cheap unlimited plans

PushWizard — 30 messages to one app on unlimited devices for free; smorgasbord of paid additions

PushWoosh — unlimited pushes to 1M devices from 5 apps for free; tiered paid feature sets

TheAppSales — “a good size number” for free

XtremePush — unlimited pushes to 1M devices from 5 apps for free; tiered paid feature sets

In the cloud service space that provide messaging on the side:

Amazon SNS — 1M pushes for free; then $1/1M pushes

App42 — 1M pushes for free; tiered price plans

Asking Point — 3M pushes for free; pay via commission

Kinvey — 5M pushes for free; tiered price plans

mobDB — 600K pushes for free; then $15/1M pushes

Parse — 1M pushes for free; then 5¢/1K pushes

If there isn’t something there that suits your feature vs. price requirements adequately, there’s always rolling your own: By far the most popular on github, which we’ll take as sufficient proof of adequacy and not bother looking further, is

Redth/PushSharp: “A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), OSX (APNS 10.8+) Android (C2DM and GCM – Google Cloud Message), Chrome (GCM) Windows Phone, Windows 8, Blackberry (PAP), and Amazon (ADM) devices!”

but if you want more choice, hey there’s 412 following it thrown up for APNS on Github, go wild.

One last special mention of noodlewerk/NWPusher that lets you do your development with a local OS X application, which certainly would have expedited many of our past projects.

Think we managed to catch all the services currently worthy of short list consideration here; if we missed stumbling over your favourite, of If you have any positive or negative experiences with any of these to share, please do!

UPDATES:

blommegard / APNS-Pusher is a nice simple app for sending individual pushes.

Continue Reading →
5

Core Data And Swift

Been quite a while since the last time we rounded up Core Data goodies, since when we’ve gone through The iCloud Angst Apocalypse and ended up with that class of problem being relegated to the new CloudKit hotness … if you don’t need, like, cross-platform access or anything. Which most people want. As, indeed, we’re going to be designing the iOS side of a project in that cross-platform space next week; so let’s take a look at what’s going on now in the new Swifty iOS 8 world, shall we?

First off, here’s an decently comprehensive curation of important tools as the Swift world dawns — keep an eye on all of these to see how they adapt to new world Swiftiness:

Top 10 Core Data Tools and Libraries :

Marcus Zarra gives us The Core Data Stack In Swift which inspired Core Data Stack in Swift Simplified

Read Swift Core Data Format String Injection — or end up as an xkcd cartoon

Like videos? There’s a bunch here. This series looks particularly worthwhile, comes with code and is updated through the current Xcode 6b5:

UPDATES:

AERecord: ”Why do we need yet another one Core Data wrapper? You tell me!”

(h/t ManiacDev) AlecrimCoreData: “a Core Data wrapper library written in Swift, “inspired” by MagicalRecord and LINQ.”

JSQCoreDataKit: “A swifter Core Data stack.” — rewrite of RSTCoreDataKit

QueryKit is a nifty Core Data query language in Swift; also check out KFData for some convenient Objective-C conveniences

SugarRecord: “…you’ll be able to start the CoreData stack structure just with a line of code and start working with your database models using closures thanks to the fact that SugarRecord is completly written in Swift.”

SuperRecord: “A small set of utilities to make working with CoreData and Swift a bit easier.”

CoreDataSwagger: “Extensions for CoreData on iOS.”

CoreDataKit: “makes common operations on objects and importing into CoreData a breeze.”

NSArray_CoreData: “Extension of NSArray for CoreData in Swift.”

CoreData preparation and Building swift frameworks

Core Data Batch Updates in iOS 8 And Swift

New in Core Data and iOS 8: Batch Updating with Core Data Demo: Batch Updating and Asynchronous Fetching

Swift: Distributing Core Data Entities Over a Network

iOS 8: Core Data and Asynchronous Fetching

Your First Core Data App Using Swift

Protocols in Swift with Core Data

Core Data versioning is not temporal … My general recommendation is to avoid heavy migrations at all costs. They are not designed to work on iOS and frequently cause issues.”

Core Data Relationships Data Loss Bug when calling migratePersistentStore

WatchKit [and all others] Extension Problem: Sharing a Core Data Store Can Lead to Duplicate Entries

Multiple NSManagedObjectContexts – preventing race conditions and deadlocks

Core Data Migrations Swift Tutorial

Core Data in Swift Tutorial (Part 1)

Swift, Core Data, and unit testing

Unit Testing Model Layer with Core Data and Swift

FBFetchedResultsController: “A drop-in replacement for NSFetchedResultsController built to work around the fact that NSFetchedResultsController does not work with parent/child contexts.”

Core Data Asynchronous Fetching in iOS 8 and Swift

Better Core Data models in Swift

Core Data Cheat Sheet for Swift iOS Developers

Sync: “Modern JSON synchronization to Core Data.”

JsonManagedObject-Swift: “Swift framework to convert JSON in NSManagedObject and vice versa.”

Core Data vs. ARC

Using Core Data with Swift “With Swift there’s a decent chance that using Xcode’s subclasses will actually crash your app … If you’re using mogenerator, you’re covered for Core Data optionals.”

Using Swift to Seed a Core Data Database

Marcus Zarra: My Core Data Stack

The Generation Gap design pattern and CoreData reminds us of mogenerator 1.28 now with “experimental” Swift code generation

Using Core Data in Swift

Core Data Basics: Preload Data and Use Existing SQLite Database

SwiftRecord: Swift Library Providing An Active Record Implemention For Managing Core Data Objects

PhiLipsStack: “aims to create a CoreData stack from model to context”

CoreStore: “Simple, elegant, and smart Core Data programming with Swift”

Shared Core Data “discusses strategies for dealing with Core Data updates across the members of an App Group.”

Core Data and Aggregate Fetches in Swift

Continue Reading →
2

Review: Learning iPhone Game Development with Cocos2D 3.0

Quite the twisted trail it’s been since we first noticed cocos2d-iphone way back in 2008 and watched it grow, split, recombine, be acquhired, and eventually have the founder jump ship for the C++ version cocos2d-x. It was looking bleak there for us peoples tasteful enough to revile the thought of sullying ourselves with other, lesser, platforms for a while there until Apportable stepped up to support what’s been a surprisingly frantic divergence from the cross-platform strains, not least the currently misnomed rechristening as “Cocos2D-Swift”.

And today, we’re going to take a look at the first and only so far book out there on learning modern Cocos2D-Swift,

Learning iPhone Game Development with Cocos2D 3.0

0144OS_Cocos2D 3.0.jpg.png

The book follows the style of introducing concepts over the course of developing a single game called ‘CocoHunt’ which can be downloaded from the App Store and has its source available on Github. It assumes basic familiarity with Xcode and Objective-C, focusing solely on Cocos2D coding. And, unfortunately, that means no discussion of SpriteBuilder, which our first reaction is a significant flaw in an introductory book to modern Cocos2D. But let’s take a walkthrough of the book, as described by itself in the Preface:

Chapter 1, All About Cocos2D, provides basic information about game engines, additional information about Cocos2D, as well as examples of great games created with Cocos2D.

In which our above concern is addressed:

However, using SpriteBuilder doesn’t eliminate the need to write the code and understand how Cocos2D works. This is why, I strongly believe that first you need to learn pure Cocos2D and after that it will be very easy to start using SpriteBuilder and make your life even easier.

Well, that’s a valid perspective. Ours is to put off learning anything that there’s easier ways to accomplish, since after 20+ years in this industry we figure that knowledge becomes obsolete so fast that investing more than the minimum you can get away with is generally a misallocation of resources.

Chapter 2, Hello Cocos2D, guides you through the installation process and reviews the contents of the Cocos2D distribution package and demo projects that come with it.

And runs you through a hello world project with a sprite and label. Straightforwardly done.

Chapter 3, Cocos2D – Under the Hood, describes the architecture of the framework and its main classes. In the second part of this chapter, we will review several Cocos2D configuration options.

This would have been a good chapter to use as an introduction to SpriteBuilder, relating the architecture to SpriteBuilder’s layout. As it is, it’s a bit awkwardly placed to break rhythm. As the author acknowledges:

I know that you want to start writing the code and creating games as soon as possible. If you just can’t fight this feeling, then skip to Chapter 4…

That we’d say is a solid clue that our suggestion is a good one. (OK, we swear we’ll stop harping on SpriteBuilder now. Really.)

Chapter 4, Rendering Sprites, begins to unveil the process of game creation. In this chapter, we will add a game scene, background image, player, and enemy characters. We will review some of the main properties of Cocos2D nodes and will make them move, rotate, flip, and so on.

Remarkably well done chapter! As well as all the display basics you’ll need, smoothly works in anchor points, character composition, and use of TexturePacker even.

Chapter 5, Starting the Action, covers the process of controlling the game using states, handling touches, or using a gyroscope to get player input. At the end of this chapter, we will have a skeleton of a playable game.

Another excellent chapter, thoroughly covers interactivity as described and works in some good coordinate spaces and vector math discussion too.

Chapter 6, Rendering Text, shows you how to display score, lives, earned points, and winning and losing labels. In this chapter, we will use both True Type and Bitmap font-based labels of Cocos2D and will discuss benefits and performance considerations.

Straightforward and competent; covers Glyph Designer too.

Chapter 7, Animations and Particle Systems, demonstrates the use of different animation types and shows how to use particle systems to get really cool effects such as explosion and fire.

Competent enough for a beginner book, although we would’ve liked a little more on skeletal animation; covers Particle Designer too.

Chapter 8, Adding Sound Effects and Music, shows how to easily add sound effects and music, switch between music tracks, and adjust audio properties.

Again straightforward and competent, nice that it mentioned sourcing and attributing from Freesound, Nature Sounds For Me, and NoSoapRadio. Cool stuff, check them out!

Chapter 9, User Interface and Navigation, concentrates on creating a convenient user interface using Cocos2D controls such as buttons, the scroll view, table view, and so on. In this chapter, we will see how to create scenes that exist in most games, such as the menu scene, about scene, and so on, and how to navigate between them.

That sound like a lot to cover? Yes it is, and the “and so on” covers a good many asides. There’s a bit too much crammed in here we think, probably would have been a bit easier to follow if focused into UI and navigation chapters; but it’s certainly very good as is.

Chapter 10, Physics, shows how to use the physics engine in your game. In this chapter, we will create a playable level using the physics engine; we will review how to create physics objects, adjust their properties, detect and filter collisions, use joints, and so on.

Yet another exceptionally well done chapter. Can’t think of an introduction to using physics engines we’ve ever read that was better than this, actually; balances features and explanation just about perfectly to get you started.

Chapter 11, Working with Tile Maps, explains tile maps and shows the complete process of creating and using a tile map in the game.

Including parallax animation as well, which is a nice feature to have explained in a learning book.

Chapter 12, Standing Out – Integrating Game Center and In-App Purchases, covers integrating Game Center and adding In-App purchases to the game.

For some reason, you have to download this chapter separately and the Preface link doesn’t work. But once you get past that gratuitous annoyance, again a straightforward and competent explanation of the described tasks. And bonus points for a nice collection of various asset-finding links for the penniless indie to finish off the book with!

So overall, we’re pretty darn impressed here, quality ranges from nicely done to downright outstanding all the way through the book; the best introductory Cocos2D book written yet, we’d say. Our only serious problem with it is that there isn’t any introduction to SpriteBuilder. And there’s a book devoted to that in progress by Steffen Itterheim, so if you’re more of a visual tool type person you might want to wait for that one. But if you want to get started NOW!, or you’re not a visual type person, then hey this is your best and most current choice for learning Cocos2D-Swift!

Continue Reading →
2

iOS 8 Grab Bag

So, pretty much got your head around Swift now and ready to move on to all the other new goodies in iOS 8? Here’s a series that’s been chugging along since WWDC well worth your time to read:

… or if you like books, just download the complete iOS 8 Day by Day eBook here.

Over in the Wenderlich tutorial empire, we see no reason to expect that this will be less awesome than the last three of which we bought all, so we’ll confidently recommend that you go ahead and preorder

iOS 8 by Tutorials: Learning the new iOS 8 APIs with Swift or hey, go whole hog with Swift by Tutorials Bundle

In the meantime, there’s lots of Swift tutorials to read.

If you deal with passwords anywhere in your app, if you’ve missed it so far (h/t: ManiacDev) head over now to

AgileBits/onepassword-app-extension

Welcome! With just a few lines of code, your app can add 1Password support, enabling your users to:

  • Access their 1Password Logins to automatically fill your login page.
  • Use the Strong Password Generator to create unique passwords during registration, and save the new Login within 1Password.
  • Quickly fill 1Password Logins directly into web views.

And even if you don’t have password management, take the time to read their very nice explanation of extension security at

Filling with your approval: On 1Password’s App Extension and iOS 8 security

Here’s a nice little button class (h/t iOS Dev Weekly) to get you started with the funky effect stuff:

AYVibrantButton is a stylish button with iOS 8 vibrancy effect. It is a subclass of UIButton that has a simple yet elegant appearance and built-in support for UIVisualEffectView and UIVibrancyEffect classes introduced in iOS 8. Yet, it can be used on iOS 7 without the vibrancy effect…

Here’s an iOS 8 savvy HUD class whose necessity is explained for those who might question it as

There already are so many other open source progress HUD components!

While other progress HUD components are nice they all have their problems. MBProgressHUD is outdated and buggy, MMProgressHUD is totally over engineered and requires a long time to implement, SVProgressHUD and HTProgressHUD are not implemented in the right way and they all don’t offer the extensibility of JGProgressHUD. JGProgressHUD was inspired by all of these components to create the ideal progress indicator.

We adore people not overburdened with modesty.

UPDATES:

For Metal links, see Thrash Metal

A Step-By-Step Tutorial On Using iOS 8′s New Keyboard Extension; The Trials and Tribulations of Writing a 3rd Party iOS Keyboard; Developing Keyboards for iOS; tasty-imitation-keyboard: “A custom keyboard for iOS8 that serves as a tasty imitation of the default Apple keyboard.”

UIAlertController Changes in iOS 8

iOS 8 Privacy Updates

iOS8 Sampler for iOS

Working with Touch ID API in iOS 8 SDK

Image Resizing Techniques and PHImage​Manager

Introducing the iOS 8 Feast!

Apps Using iOS 8 Extensions

What we learned building the Tumblr iOS share extension

EL Mustache – iOS 8 Photo Extension in Swift

iOS 8 Handoff Tutorial; Working with Handoff in iOS 8 and Part 2: Using Continuation Streams

Tutorial: Creating Interactive Notifications With iOS 8’s Notification Actions; Interactive Push on iOS using App42 Cloud

Introduction to iOS 8 App Extension: Creating a Today Widget

Share Extension Iterations

Building a Simple Share Extension in iOS 8 App

View Bridge Logging for app extensions

Introducing MMWormwhole

Porting Your App to the iPhone 6, iPhone 6 Plus and iOS 8: Top 10 Tips

Tutorial: How To Create An iOS 8 Action Extension

Updating to the iOS 8 Search Controller

Secure Your App’s Passwords with Safari AutoFill in iOS 8

iOS 8’s built-in virtual keyboards on the iPhone: A visual catalog

UISplitViewController Tutorial: Getting Started updated for iOS 8 universality

Variable Height Woes

Continue Reading →
0
Page 3 of 99 12345...»