January 2012
1 post
1 tag
A Brief, Incomplete, and Mostly Wrong History of... →
December 2011
5 posts
Programming, Motherfucker →
3 tags
Twitter Integration
With more than 3000 apps integrated with Twitter, is not really a big surprose to learn that iOS 5 adds APIs to make things even easier.
If all we need to to allow users to push tweets from our apps, then it is really easy. All we need to do is to link the ´Twitter.framework´ and then import Twitter/TWTweetComposeViewController.h where we need it. TWTweetComposeViewController is basically a...
3 tags
Werror or GTFO
There are a few useful warnings that should be set in any Xcode project. Here them, and why you should care:
Mismatched Return Type Warns if a function does not declare a return type, or if the return type is not void, but a return statement is found without a return value.
Sign Comparison You have a signed and and unsigned comparision. This warn will let you know if the result is incorrect...
1 tag
November 2011
1 post
2 tags
Not always faster
A few weeks ago, I was asked how to sort an array, and I was prompt to answer “using GCD”. Bilal LoLo (@anabillo) ask again “why not NSSortDescriptor”, and I was “because GCD is faster”. Is it? Well, there is an obvious way to know. Truth be told, I was using sort descriptors before GCD was introduced to the phone. And when it was introduced, I automatically...
October 2011
3 posts
2 tags
1 tag
Instagram Engineering: Sharding & IDs at Instagram →
instagram-engineering:
With more than 25 photos & 90 likes every second, we store a lot of data here at Instagram. To make sure all of our important data fits into memory and is available quickly for our users, we’ve begun to shard our data—in other words, place the data in many smaller buckets, each holding a part of…
3 tags
When the deal goes down
I’m pretty sure that your code, as mine, never has bugs. It just develops random features. But you know, sometimes sheet happens, or at least that’s what I’ve been told.
In Cocoa there two mechanism to deal with, let’s say, random features. Exceptions, and error reporting. Apple strongly recommends not to use exception like in other platforms. In Cocoa, exceptions are...
September 2011
8 posts
2 tags
Something and nothing
NSValue
Many Cocoa classes, like NSArray and NSValue only takes objects as parameters. What to do when you have a non-object value you want to store? Simple, use NSValue.
Let’s say we want to store a [CGRect struct] [1] into an array.
CGRect rect = CGRectMake(0, 0, 300, 300);
NSValue *rectValue = [NSValue valueWithBytes:&rect objCType:@encode(CGRect)];
NSArray *array = [NSArray...
1 tag
Basics →
Talking about basics, a must see for anyone interested in Objective-C / Cocoa.
4 tags
Back to Basics
Primitives
Primitives are defined by Objective-C, not by Cocoa, they are not objects, we can think about them as the atoms of Objective-C
The most basic data type is the integer or int. An integer is a whole number, that could be positive or negative. 42 and -74 are integers.
By default, variables of type int are signed, which mean that they can represent both, positive and negative values....
15 tags
2 tags
4 tags
Core Data Classes
The very basic functionality of Core Data is to store objects. Each object should be defined presenting the entities to be persisted, and the relationships between them.
Core Data provide a set of classes to deal with this whole “model definition” issue.
Model
* `NSManagedObjectModel`: A model is where we describe a collection of entities. Is like an *schema*
*...
If our ideas seem smaller nowadays, it’s not because we are dumber than our...
– The Elusive Big Idea - The New York Times (via domleca)
Thought provoking, indeed
6 tags
Internationalization and Localization in iOS
iOS and Cocoa in general is well know for providing a wide range of internationalization,almost for free. Let’s take a look at these technologies
API Name
Description
NSLocale
Properties related to the current region, including formats
NSNumberFormatter
Formats and parses number
NSDateFormatter
Formats and parses dates and times
NSCalendar
Support for various types of calendars...
May 2011
1 post
1 tag
April 2011
2 posts
3 tags
2 tags
IPv6 on iOS
iOS 4 and IPv6
iOS 4 incorporated the full network stack of the CoreOS, that means, basically, support for IPv6.
Apple has added initial support for DHCPv6 for DNS server addresses, search domains, etc. Essentially, the Core Network layer uses the stateless capability of IPv6 to gather the IP address, but uses DHCPv6 to get other important information.
Any code that uses CFNetwork, already...
March 2011
2 posts
4 tags
February 2011
1 post
3 tags
January 2011
1 post
3 tags
November 2010
3 posts
cars10 asked: Heya Volon!
Do you know if it is possible to send/receive layer 2 ethernet frames (on raw sockets) on an iPhone / with iOS ?
Thanks and best regards,
Carsten
Do you know if it is possible to send/receive layer 2 ethernet frames (on raw sockets) on an iPhone / with iOS ?
Thanks and best regards,
Carsten
1 tag
if you’re not embarrassed when you ship your first... →
1 tag
October 2010
15 posts
4 tags
Size does matter
One of the most daunting challenges for the iPhone app designer is not the size of screen, but the fact that its input device is no other than a human hand. With a mouse, or a stylus, you can get precise input, down to the level of the pixel. With a human finger, you don’t, even worse, most of the time, the screen is going to be partially covered with a hand. In fact, there is no physical...
3 tags
What is Mobile
To better understand what kind of applications are suitable for a mobile device, we might need to consider the mindset of a typical user when he or she is more prone to use a mobile app. Typically, he or she needs to perform a really simple task, or wants to know what is around, or just kill some time playing or entertaining him or herself.
Simple Task
It is really tempting to deploy a whole...
5 tags
Application Definition Statement
Mobile platforms are very special. By definition, people that uses mobile apps are moving. and thus has no time to spare for an app.
People, real people, uses apps in all kind of contexts, and a wide range of environments, but frequently, the user attention is divided between the app, and the real world. Most users has no time (neither are interested) in immersive processes, but in tomorrow...
4 tags
4 tags
Protect Data in Transit
One of the weakest points of any application, is the information interface with the outside world. This is particularly true for iPhone apps.
Nowadays, the vast majority of devices that run OS X are mobile. So we need to be suspicious of things like Domain Name System, and the local network in general. Traffic on a wireless network can be easily monitored, and tampered with by a third party....
3 tags
Running Privileges
So, we have seen a little bit about security, let’s focus on the topic a little longer.
The actual way applications are ran, varies enormously from desktop to phone. On desktop applications can run with administrative privileges. On the phone apps are ran inside a sand box. That’s why we are going to talk a little while just for desktop development.
So, one of the most important...
5 tags
Stack Overflow
A few days ago, my dear friend Adrian Kosmaczewski published a wonderful article about C and C++ as the foundation of a good Cocoa coder. He was kind enough to let me read a draft, and i have to say that reading his excellent review of the memory architecture, I remind the olds days exploiting buffer overflows for fun. Fun? you may ask, and yes, it is fun to try to understand the inner workings of...
2 tags
Creating UI assets for the iPhone OS →
6 tags
4 tags
Distribute iOS Apps
One of the great features introduced with iOS 3.2 is the distribution system, specially, the capability to build and archive an application.
An archive is like a frozen build. Why this is a great idea? Well, in order to be able to symbolicate a crash report generated by a particular release, the descend that was created from the build has to be preserved. Many of us has accustom to preserve the...
3 tags
One more running time check
In my previous post, I forgot one of the most used, how to know if you are running on an iPad. This is specially important if you want to deploy your app as a single binary. UI_USER_INTERFACE_IDIOM() will return UIUserInterfaceIdiomPhone for the phone and UIUserInterfaceIdiomPad for the iPad.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// perform iPad exclusive code
} else {
...
5 tags
Bullet Proofing your App
Thanks to the Deployment Settings, we can deliver an application that supports earlier versions of the OS. But for every major OS release, a new bunch of APIs are included by Apple. Should we refrain our desire to include these cool new features? Never, thanks to the dynamic nature of Objective-C we can safely code our way out of trouble and have fun with new features.
Classes
Let’s say...
6 tags
Project Structure in Xcode 4
Project Settings might be intimidating at first, but we should not fear nothing but fear itself, and besides, there are just a few things we need to take care of.
First, we need to set the Base SDK, from the target Build Settings, inside the Architecture section, we choose the appropriate iOS version. Here is where we tell Xcode which version needs to use to build the app. This version should be...
4 tags
Address Book Framework
Plenty of iOS apps are, somehow, a portal to a social world, and hence, they can benefit from the Address Book framework. And we are going to talk a little about this framework today.
Address Book Framework is, actually, the foundation of the Address Book app, either on the Mac or the phone. It is a C framework written with Core Foundation, and as most of the other core frameworks, there are...
2 tags
Why the revolution will not be tweeted. →
The marvels of communication technology in the present have produced a false consciousness about the past
September 2010
5 posts
2 tags
There are two possible outcomes: If the result confirms the hypothesis,
then...
– http://www.lucidcafe.com/library/95sep/fermi.html
2 tags
iPhone Development Costs →
5 tags
More Multitasking in iOS. Task Completion
IMPORTANT: Yuval fixed the sample project. I’ve really appreciate your work and your fix Yuval. Thanks.
So, last week we’ve talked about multitasking in iOS. Particularly, we talked about the basic set of API implemented by Apple that allows a non-concurrent environment where the application can switch between the foreground and the background real fast.
Now we are taking about the...
3 tags
Wonderful series of how TDD is done in the real... →
Is the Infinite Improbability Drive getting... →
August 2010
11 posts
6 tags
Reducing Memory Usage in Background
When the app is entering background, the System will relinquish a lot of memory on our behalf. One really important thing that the system will take care of is the backing graphic store. A huge amount of memory goes to maintains the view hierarchy of the app, so we are getting saving a lot here. The infamous cache associated with -imageNamed: method of UIImage is also flushed. Not the actual...
9 tags
Multitasking in iOS
It might not be a bigger feature in iOS 4 than multitasking, so let’s review it, and most importantly, how to enable multitasking on our apps.
As we all know, Apple was reluctant to let third party apps to run in the background. Mobile devices, Apple maintains, have limited resources (CPU, RAM, etc), and thus, there is no a lot of room for general purpose concurrency. On the other hand,...