Archive for 'iPhone'

Background Fetch Caveats

Couple interesting posts lately about background fetch resource usage. If you’re not familiar with background fetch, that’s an iOS 7 thing that’s explained quite nicely in objc.io’s Multitasking in iOS 7 article:

Background Fetch is a kind of smart polling mechanism which works best for apps that have frequent content updates, like social networking, news, or weather apps. The system wakes up the app based on a user’s behavior, and aims to trigger background fetches in advance of the user launching the app. For example, if the user always uses an app at 1 p.m., the system learns and adapts, performing fetches ahead of usage periods. Background fetches are coalesced across apps by the device’s radio in order to reduce battery usage, and if you report that new data was not available during a fetch, iOS can adapt, using this information to avoid fetches at quiet times…

But the naîve user may find a surprise in wait:

An Unexpected Botnet

… There is, however, an intrinsic danger in applying this ability without fully thinking through the implications. When enabled within your applications you are essentially building a massively distributed botnet. Each copy of your application will be periodically awoken and sent on a mission to seek and assimilate internet content with only the OS safeguards holding it back. As your app grows in popularity this can lead to some rather significant increases in activity…

Here are the feed request frequencies for various Background Fetch enabled podcast clients … For an RSS feed that changes only once per week just these apps produce 126k web requests each week (out of 160k across all aggregators ). The feed itself is 450KB (49KB gzipped). Where it not for HTTP caching/compression (discussed later) this would be generating 56GB of almost entirely unnecessary downloads each week…

That is, indeed, a lot of almost entirely unnecessary downloads. The developers of Castro chimed in here:

The Value of Background Fetch [Point]

… Our strategy with Castro has been to employ Background Fetch to help us avoid the ongoing cost of a server. Castro polls each subscribed feed from the app regularly and posts local notifications when new episodes are found. There are pros and cons to this approach.

Pros

  • We spend no time on web app development or money on server hosting. Xcode is always open.
  • We have no scaling concerns.
  • The continued functionality of the app is not dependent on future sales.
  • There are fewer points of failure.

Cons

  • Worse update performance since the app hits every individual feed, rather than one centralised server.
  • A central server gives developers flexibility to fix individual feed issues, like poorly formatted dates or duplicate episodes for example…

Well, being big believers ourselves in not doing work we don’t have to, that makes a pretty compelling argument, indeed. But hark! Here’s a counterpoint from coming soon Castro competitor Overcast author Marco Arment:

The Value of Background Fetch [Counterpoint]

… Service-backed apps still have a lot of advantages and exclusive capabilities over iOS 7’s Background Fetch. I think server-side crawling is still the best choice for podcast apps and feed readers, for which users want fast updates to collections of infrequently updated feeds.

Overcast has been crawling tens of thousands of podcast feeds every few minutes for the last 6 months using standard HTTP caching headers. In the last week, 62% of all requests have returned 304 (“Not Modified”). Many of the rest returned the entire “new” feed, but none of the episodes had actually changed, making the server download and process hundreds of kilobytes unnecessarily.

An app using Background Fetch needs to make all of those fruitless requests just to get the handful of occasional changes. All of those requests cost processor time, memory, battery power, and data transfer. And each copy of the app needs to download those hundreds of wasted kilobytes when a server erroneously reports an unchanged feed as new…

A server can simply send a silent push notification to all subscribed apps when there’s new data in a feed, and each app can download just the changes. With infrequently updated feeds, like podcasts, this leads to huge savings in battery life and transferred data over time…

Well, there’s that too. So yeah, if you can’t count on decent 304 support, background fetch is not your resource-optimal choice no.

Lots of good numbers to crunch through, so read the whole posts. Personally, if the choice for your particular application is less than immediately obvious, we’d recommend implementing both methods; that way, if your service goes down, or you stop paying for it, or whatever, the app can remain functional. Safety first and second, that’s us!

UPDATES:

Apropos of things to do to avoid users calling out your app as battery-hogging, take a gander at The Ultimate Guide to Solving iOS Battery Drain

Continue Reading →
0

All About Strings

Are you reading objc.io? If not, you should be. Check out issue #9 for more than you ever realized you didn’t know about strings. Yes, strings.

Quick now: How do you correctly find the length of a string containing odd characters like emoji? And how can you be certain you’re comparing strings with combining characters for visible equivalence correctly? If the answers don’t spring to mind, check out NSString and Unicode.

How do you correctly, i.e. locale-aware, join a list of items for text display? That’s one of the many tidbits in Working with Strings.

No doubt you know how to use localized .strings … but did you know in iOS 7+ you can do locale-aware plurals with .stringdict files? And do you know how to correctly display a localized file name? See String Localization.

Need to validate your input? Or have a full expression grammar? Check out String Parsing.

Finally, know how to calculate bounding rects for attributed strings in the new non-deprecated iOS 7 way? And how to lay out hanging indents for lists and decimal-aligned number tables with Text Kit? If not, here’s String Rendering to get you up to speed.

Haven’t seen a developer periodical this consistently high quality through issue #9 since … well, ever, actually … so we strongly encourage you all to subscribe with their app to keep the goodies coming!

UPDATES:

Extending “strings” to include “text” — Open Source Library And Editor Tool For Easily Formatting Text Within Your Apps

Continue Reading →
0

Custom Keyboards

For our Underutilized iOS Feature Of The Week award, how about UITextField/UITextView’s inputView field? Probably pretty much totally overlooked it, haven’t you? Here’s a sample implementation for next time something like that strikes your fancy (h/t: iOS Dev Weekly):

venmo / VENCalculatorInputView: Calculator keyboard used in the Venmo iOS app:

687474703a2f2f692e696d6775722e636f6d2f565767796d6a482e676966.gif

If you don’t have custom input needs but just want to improve the regular keyboard experience, there’s news for you too: Fleksy has released an iOS SDK that lets users long press to switch keyboards, if they’ve installed the free Fleksy app:

Screen Shot 2014-02-23 at 2.34.47 PM.png

And here’s another project to improve the default keyboard:

tonqa / JustType – The Better Keyboard for iOS

JustType is a keyboard extension using swipe gestures, highlighting and suggestions. It is built to be used in any iOS text editor and all text-intensive iOS apps. And it is really easy to use. If you want to have a video demonstration you can find it on this blogpost.

And just as a side caution, if you do get all excited to implement a custom keyboard with transparency and it displays funny in iOS 7, check out this Stack Overflow question!

Continue Reading →
0

TestFlight, R.I.P.

So no doubt pretty much everyone reading this uses TestFlight for distributing their betas, yes? Well, looks like you might have to rethink that plan.

First up, their FlightPath (née TestFlight Live) analytics disappeared with just a note to participants “so we can focus on other areas of the business”. Well, bad ideas disappear all the time; apparently that turned out to be a bad idea, competing with Flurry. Surprise level: 0.

Second up, they decided to ditch Android completely:

We are refocusing TestFlight on iOS. While we will continue to support app development on iOS, support for Android beta testing on TestFlight will stop by March 21, 2014.

What does this mean?

After 3/21/2014 no user will be able to upload any Android builds to TestFlight.

Whilst of course we thoroughly approve of that strategy, it seems … out of step with market conditions, does it not? Surprise level: high.

Next up, they stopped taking new customers on iOS too:

On 2/19/2014 we announced that only Teams who have previously uploaded a build with the TestFlight SDK will be able to continue to upload builds with the SDK.

What does this mean?

If you are an existing Team that has previously uploaded a build with an SDK attached you will need to upgrade to the latest SDK version by 2/26/2014, afterwards your build will be rejected until it has the correct SDK version.

If your team has never uploaded a build with an SDK or you are a new TestFlight user then you will not be able to incorporate any version of the TestFlight SDK. You will be asked to remove the SDK from your build and re-upload.

OK, now things are getting downright weird. Surprise level: WTF?

Well, the sleuths over at TechCrunch figure they know what’s going on:

TestFlight Owner Burstly Acquired By Apple

Burstly, the makers of an in-app ad management platform called SkyRocket and the parent company of popular mobile app testing platform TestFlight, has been acquired, we’re hearing. Though we’re working to get more information on this now, including deal terms, our understanding is that Apple is the acquirer here.

We’ve been pointed in Apple’s direction by a couple of sources…

Well, on the one hand that’s just about out of character as Apple acquisitions get, on the other hand, we sure don’t see any other plausible explanation for the increasing oddity of recent events, do you? Hopefully Apple just had a “why didn’t we do exactly this all along?” epiphany and are just bringing the TestFlight we all know and love under their umbrella, but on the off chance that’s not what’s going on here, maybe you all want to sign up for HockeyApp while the signing is good!

UPDATE:

All right, this is the first time we’ve updated a post inside the hour: It’s official!

Apple Confirms Burstly Buy

“Apple buys smaller technology companies from time to time, and we generally do not discuss our purpose or plans,” company spokeswoman Kristin Huguet told Re/code.

So yeah, anything you’re relying on TestFlight for right now: figure out a Plan B. Just in case.

MORE UPDATES:

From Crashlytics Labs: Announcing Our Beta Distribution Tool

Continue Reading →
0

iTunes Connect Help

Ever get frustrated with submitting your apps/IAP/Game Center stuff through iTunes Connect? Yes, who hasn’t, indeed. Check out this piece for some help with saving your sanity:

Mastering Command-Line iTunes Connect Submissions

… iTunes Connect is, of course, a critical piece of the Apple developer puzzle. However, inputting any serious amount of content requires more than a little bit of patience, good luck, and praying to the powers-that-be that iTunes Connect doesn’t kick you out before you’ve uploaded your marketing assets and copy.

As the person managing the localisation of our apps and App Store copy, I spend a not-inconsiderable amount of time dealing with iTunes Connect and you can easily lose an afternoon in the system when you’re refreshing up to 15 screenshots, the release notes and marketing copy in each localisation. It’s a similar story for the Mac – huge Retina screenshots that can only be uploaded one at a time make for a time-consuming and often infuriating process.

However, there’s a relatively little-known tool available from Apple that can ease your pain, allowing you to retrieve, pre-flight and upload your app metadata…

Ever notice the ‘Transporter User Guide’ link under ‘Deliver Your Apps’ on iTunes Connect? Yep, that’s the relatively little-known tool.

But there’s some extra niftiness here:

Whilst Transporter has been a great improvement to our workflow, I’ve been itching to improve it further. To get things started I’ve built a small app that allows you to avoid both the Terminal and iTunes Connect itself to submit your iTMSP packages. It’s called Connecter, and the source is available on GitHub

commandlineitunes.png

Worth checking out for lowering the pain level on your store management, yep.

h/t: iOS Dev Weekly!

UPDATES:

Open Source Tool Providing An Extensive CLI For Working With iTunes Connect

How to submit multiple iOS In-App Purchases

Apple In-App Purchase: Creating App Store Hosted Content

Continue Reading →
0

Design Prototyping: Origami

This is a pretty nifty approach to prototyping your interface:

Screen Shot 2014-02-01 at 7.33.20 PM.png

Most designers today create static mockups to communicate app ideas. But increasingly apps are anything but static, which means as designers we need a better tool for interaction design.

Origami is a free toolkit for Quartz Composer—created by the Facebook Design team—that makes interactive design prototyping easy and doesn’t require programming…

Neat. And it made #1 on this list of 10 interactive design prototyping tools to check out, no less.

Check out the introduction post here, and if that looks interesting download it from the link above, follow @FacebookOrigami, and if you want to get out on the bleeding edge the repo is at facebook / origami!

h/t: iOS Dev Weekly!

UPDATES:

Facebook Develops A Photoshop For Interaction Design, And It’s Free For Anyone To Use

Prototyping with Facebook Origami

ideo/avocado : A Toolbox For Creating Interactive iOS App Prototypes Enhancing Facebooks Origami

Continue Reading →
0

Animation: Canvas

Feel like adding a little gratuitous animation to your interface? Here’s a library that makes that easy:

Screen Shot 2014-01-28 at 7.11.10 AM.png

“Without code”? Huh? What they mean is that you can configure animations directly in storyboards:

Screen Shot 2014-01-28 at 7.04.02 AM.png

Helps out with custom fonts, blurred backgrounds, and other goodies as well. Check out the usage guide here, CanvasPod / Canvas on github, and follow @CanvasPod if that looks handy!

h/t: iOS Dev Weekly, ManiacDev!

Continue Reading →
1

Optimizing Network Traffic: CocoaSPDY and FastCoding

Ever have discussions of this pattern?

BOSS: Do me this obviously ludicrous so data heavy as to be next to impossible to make work at all network-based thing.

YOU: Uh … ok. <do next to impossible thing>

BOSS: It’s too slow! And too expensive! Waaaaaah!

Here’s a couple of options to be aware of when you’re trying to squeeze every last bit of juice out of your network traffic:

CocoaSPDY: SPDY for iOS / OS X

For over a year now, Twitter has supported the SPDY protocol and today it accounts for a significant percentage of our web traffic. SPDY aims to improve upon a number of HTTP’s shortcomings and one client segment in particular that has a lot of potential to benefit is mobile devices. Cellular networks still suffer from high latency, so reducing client-server roundtrips can have a pronounced impact on a user’s experience…

One of our primary goals with our SPDY implementation was to make integration with an existing application as easy, transparent, and seamless as possible. With that in mind, we created two integration mechanisms—one for NSURLConnection and one for NSURLSession—each of which could begin handling an application’s HTTP calls with as little as a one-line change to the code…

We’re still actively experimenting with and tuning our SPDY implementation in order to improve the user’s experience in our app as much as possible. However, we have measured as much as a 30% decrease in latency in the wild for API requests carried over SPDY relative to those carried over HTTP.

In particular, we’ve observed SPDY helping more as a user’s network conditions get worse…

If you’re slow because you’ve got a whack of back and forth traffic with a SPDY-enabled data source, this could be a pretty big win — as noted above, especially with the absolutely horrible latencies seen on cell networks that us developers tend to overlook since we’re always developing with wifi connected.

More likely though, your only big wins are going to come from optimizing your data representation, optimizing its JSON, switching to binary plists, and so forth, and here’s an interesting-looking new option to consider for that step:

nicklockwood / FastCoding: A faster and more flexible binary file format replacement for Property Lists and JSON

FastCoder is a high-performance binary serialization format for Cocoa objects and object graphs. It is intended as a replacement for NSPropertyList, NSJSONSerializer, NSKeyedArchiver/Unarchiver and Core Data.

The design goals of the FastCoder library are to be fast, flexible and secure.

FastCoder is already faster (on average) for reading than any of the built-in serialization mechanisms in Cocoa, and is faster for writing than any mechanism except for JSON (which doesn’t support arbitrary object types). File size is smaller than NSKeyedArchiver, and comparable to the other methods.

FastCoder supports more data types than either JSON or Plist coding (including NSURL, NSValue, NSSet and NSOrderedSet), and allows all supported object types to be used as the keys in a dictionary, not just strings.

FastCoder can also serialize your custom classes automatically using property inspection. For cases where this doesn’t work automatically, you can easily implement your own serialization using the FastCoding Protocol…

Looks like a pretty nice set of advantages for your local serialization needs, and would likely be applicable to network transmissions as well; the format is simple chunk based so should be easy to create/parse as applicable with your network service development environment of choice.

As always, if you’ve got any more unconventional or obscure tricks you use to speed up and/or cut down size of your network traffic, let us know!

UPDATES:

Just in case you missed it, SPDY protocol support is available in NSURLSession on OS X Yosemite and iOS 8, and also used by UIWebView and Safari!

Continue Reading →
0

Cocos2D V3 + SpriteBuilder 1.0

Not too many open source projects survive the founder leaving, most especially when it’s to a direct successor of that project, but those of us who were distinctly out of sorts at the thought of sacrificing our friendly Objective-C Cocos2D in blood and tears to the fixation on the cross-platform development chimera of the people who pay us to have fun can celebrate today:

Cocos2D V3 RC1 release

We are excited to announce the coordinated release of Cocos2D V3 and SpriteBuilder 1.0!

This release of Cocos2D brings three major improvements to the Cocos2D community: SpriteBuilder, which is a professional GUI editor for easy iteration on games; Chipmunk2D integration for rapidly developing physics-based games; and Apportable support out-of-the-box for all this, so that your Objective-C games can run on Android!

So for those that haven’t been keeping score so far, the number of cross-platform development environments using Objective-C just went from zero to one. Pretty cool, huh?

SpriteBuilder’s visual editor enables developers to quickly prototype and build high quality games with intuitive, elegantly designed tools. Designers and developers can work seamlessly together and drastically cut development time. SpriteBuilder is the only game development suite that allows you to run your Objective-C code as a native app on Android. Apportable compiles Objective-C programs directly to ARM or x86 machine code, so a game built with SpriteBuilder will run faster on Android than a game written in Java or other languages…

And what’s awesome sauce on that awesomeburger is that SpriteBuilder is open source, so writing yourself a custom level editor just difficulted down fantastically to boot. Check out this reddit Q&A for some more interesting tidbits.

If you’re in a hurry to check it out, as you should be, here’s the Getting Started page, and there’s already some tutorials and demos out there:

How To Make A Simple iPhone Game with Cocos2D 3.0 Tutorial

Clone Angry Birds with SpriteBuilder

CocoRoids: Example game for Cocos2D v3 using CCPhysics and SpriteBuilder features.

CCPhysicsColorMatch: A simple CCPhysics based color matching game.

We’re certainly hoping this investment works out well for Apportable; can’t think of any other development suite anywhere where the tool chain is fully open sourced and also backed by a sustainable revenue model, which aligns the interests of everyone involved in remarkable consanguinity. So do your part by paying up to Apportable for at least an Indie license, so they can keep their “about seven engineers” working on it!

UPDATES:

The Guide to Building and Customizing SpriteBuilder v1.x

Building a real time multiplayer game with SpriteBuilder

Layouting with SpriteBuilder and Cocos2d 3.0

Migrating to cocos2d-iphone v3 – Tips & Tricks

Using PhysicsEditor with Cocos2D V3

Continue Reading →
1

Pods in Poses Pro 2

So the last couple weeks we’ve been working on rewriting our very first nontrivial app to act like a decent citizen of iOS 7. Which remained essentially unchanged architecturally from late 2008 up until last month, save for the grafting in of IAP to download content instead of ship separate apps in early 2010. Have you taken an iOS 2 architectured app and rewritten it for iOS 7? Makes you really, seriously, appreciate just how far and fast this business of ours is moving, that’s for sure. So in the spirit of those tool posts people like making, let’s list the third party goodies we used, none of which existed when this product was written, just for a get-off-my-lawn chuckle at how hard things were in those sadly primitive days five whole years ago. And to point out some nicely iOS 7 savvy convenience pods that might have escaped you thus far.

1) mogenerator and Core Data reduced the data management code by three full orders of magnitude. Not to mention that being able to preload all your data with an OS X command line tool and test it at creation time saves multiple weeks’ worth of futzing around tracking down mistypes in your plists like we did back in those iOS 2 days. Ah, automation is wonderful.

2) Urban Airship is of course the unquestioned leader in push notification these days — we’d actually started working with iLime at some point here, remember them? — and it took just a few lines to use it to implement remote unlocking of iTunes Store hosted IAPs; functionality the current version manages with delusions of adequacy via a Google App Engine backend and our own content hosting. All of which we will be absolutely enthralled to send packing.

3) Flurry likewise for analytics. We’d almost got around to successfully integrating Pinch Media — remember them? — at some point, but ran into some kind of link problem or something that we forget now and didn’t bother holding up shipping for. And never got back to. Add four years, and why, it’s just amazing how free and easy analytics are to drop in, isn’t it now?

4) Speaking of free and easy, wow does Crashlytics ever rock. Remember when dropping in PLCrashReporter was bleeding edge state of the art crash management? This project does.

5) And finally getting around to our post title here, CocoaPods takes in a walk the Best Damn Hero Award for Awesomeness Of Expedited Development compared to five years ago. For anybody, but especially for us; twenty years of making a living mostly out of porting from Windows before this iPhone thingy happened along has trained us to crank up our compiler warnings to self-righteously OCD level — why yes, everything we write for our own projects does compile just fine with -Weverything, how about you? — and -Werror in release builds too. Which makes it always a time sucker to integrate other people’s code. CocoaPods sidesteps that nicely, as well as real problems, and even sorts acknowledgements for you. What’s not to like, indeed. Bonus mention to CocoaControls for including CocoaPod savviness in their likewise intrinsic awesomeness.

Here’s the pods that we’re linking into the version shipping off to the Apple approval gauntlet soon as we pull all the non-code stuff together:

pod 'AFNetworking', '~> 2.0.3’

Pretty sure most everybody uses AFNetworking these days for their networking needs, RIP ASIHTTPRequest. The funny part here is that after setting up CocoaPods for the new version’s project thinking “we’ll throw in AFNetworking for one pod to start out with, OBVIOUSLY we’ll be using THAT” we ended up not actually having any networking needs in the 2.0 release — everything that we absolutely had to do ourselves over the network in the first version was replaced by the libraries above or rendered obsolete by free Apple-hosted IAP, and what little remained hasn’t turned out important enough to bother with right now. But we probably will later, so we didn’t bother taking it out. Besides, it gives us a chuckle thinking of all the time spent tracking down networking issues back in the day every time we look at it.

pod 'CTFeedback', '~> 1.0.4’

CTFeedback adds a nice info-providing wrapper around your standard mail feedback writer.

pod 'FastImageCache', '~> 1.2’

FastImageCache is woo-hoo! fast. Got any gallery-type displays? Use it.

pod 'JPNG', '~> 1.2’

nicklockwood / JPNG “is a bespoke image file format that combines the compression benefits of JPEG with the alpha channel support of a PNG file.” And you can use it just like a JPEG where you’re not concerned about alpha, convenient that.

pod 'MRProgress', '~> 0.2.2’

MRProgress has all kinds of looking right at home in iOS 7 progress display options.

pod 'RMStore', '~> 0.4.2’

RMStore in our opinion does by far the best job of actually helping you instead of mostly getting in your way of any of the IAP helpers out there. And does iOS 7 receipt verification! Hosted downloads aren’t integrated into the main distribution yet, but this pull request works just fine for us.

pod 'TDBadgedCell', '~> 2.4.1’

TDBadgedCell does up your cell badges nice, looking fittingly in place in iOS 7.

pod 'TWSReleaseNotesView', '~> 1.2.0’

TWSReleaseNotesView shows release notes — either included with the app or pulled from the store automatically.

pod 'UAAppReviewManager', '~> 0.2.0’

UAAppReviewManager is like your usual review beggar alert, and extra niftiness like affiliate support and OS X support.

pod 'WYPopoverController', '~> 0.1.7'

WYPopoverController is pretty darn sweet for laying out your iPhone + iPad storyboard-based iOS 7 UI with optimal aplomb.

Kinda cool to look at this list of third party goodies that made your 2013 app development faster and better and compare with the “absolutely nothing” that would have made up an empty post on the same topic for the 2008 version of the app, isn’t it now?

Continue Reading →
3
Page 5 of 99 «...34567...»