APNS Resources
March 13, 2010 – 11:43 Share on TwitterJust a reminder: I keep my list of Apple Push Notification Service Gateways up-to-date.
You can find it on my blog here.
Just a reminder: I keep my list of Apple Push Notification Service Gateways up-to-date.
You can find it on my blog here.
I was in Reading UK last week to attend the NSConference 2010. I will not write a full report of what happened there, because others will do that better.
The only thing I want to say is:if you want to improve your skills in Cocoa, for Mac, iPhone or iPad, you should go: you’ll have the best speakers, the best organization you can dream of. And you will come back with new contacts, new ideas, new code to try.
You can (should) read Alex Repty report here.
If, like me, you are tired seeing all these rumors about the absolutely freaking crazy product that Apple MAY announce tomorrow, and you are tired of reading about these rumors on absolutely every website in the world, I have a solution for you.
It’s a GreaseMonkey (and GreaseKit) script that will obliterate all mentions of the words “Tablet”, “iSlate”, “iPad”, “iTablet” and replace them with “Unicorn”, because more people have seen Unicorns than the famous iTablet.
Read the rest…
Have you ever wanted to add an UIWebView to your application, so you can browse the internets without leaving your application? While it is a trivial task to add an UIWebView to a project, there are some links that an UIWebView will not handle.
These are:
I’ve written a generic BrowserViewController, code available on GitHub here: http://github.com/sburlot/browserviewcontroller which handles all these cases:
mailto links are handled with a MFMail: I tried to handle all variations on the link: “to”, “cc”, “subject” and “body”.
YouTube, Map, iTunes and AppStore links are opened in their respective apps.
You can customise the view and decide if you want a navigation tab bar or not.
The navigation tab bar will add standard web buttons: Back, Forward, Stop, Reload and also a button to send the url of the current page via email, or open it in Safari.
Enjoy!
The swiss TV (TSR) made a portrait of me, for the tech show “Nouvo”. Grab it here while it’s hot: Nouvo, sept. 30 2009
There are different schools on how to start the design of an iPhone app. Some will prefer designing on paper (I do), others will use the computer to design their next breath-taking GUI.
So here is a list of some of the tools, template to design your next iPhone application.
Templates:
Specialized Tools
For pen & paper aficionados:
In Pragmatic Thinking and Learning: Refactor Your Wetware, Andy Hunt recommends using pen and paper to use your right brain and free your creative mind. When using a computer, you will concentrate on the details, not the complete user experience.
Another drawback of using a computer: if you show your design to the client, he also will concentrate on the details (“can you change the shade of this red button? It’s TOO red.”). Showing a hand-drawn design will let him imagine how the final product will look. This can be a double-edged sword, so you better know what the customer is expecting before using one of these techniques.
For my current project, I have to rotate a CGImageRef by an arbitrary angle.
Here is the code:
- (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle
{
CGFloat angleInRadians = angle * (M_PI / 180);
CGFloat width = CGImageGetWidth(imgRef);
CGFloat height = CGImageGetHeight(imgRef);
CGRect imgRect = CGRectMake(0, 0, width, height);
CGAffineTransform transform = CGAffineTransformMakeRotation(angleInRadians);
CGRect rotatedRect = CGRectApplyAffineTransform(imgRect, transform);
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef bmContext = CGBitmapContextCreate(NULL,
rotatedRect.size.width,
rotatedRect.size.height,
8,
0,
colorSpace,
kCGImageAlphaPremultipliedFirst);
CGContextSetAllowsAntialiasing(bmContext, FALSE);
CGContextSetInterpolationQuality(bmContext, kCGInterpolationNone);
CGColorSpaceRelease(colorSpace);
CGContextTranslateCTM(bmContext,
+(rotatedRect.size.width/2),
+(rotatedRect.size.height/2));
CGContextRotateCTM(bmContext, angleInRadians);
CGContextTranslateCTM(bmContext,
-(rotatedRect.size.width/2),
-(rotatedRect.size.height/2));
CGContextDrawImage(bmContext, CGRectMake(0, 0,
rotatedRect.size.width,
rotatedRect.size.height),
imgRef);
CGImageRef rotatedImage = CGBitmapContextCreateImage(bmContext);
CFRelease(bmContext);
[(id)rotatedImage autorelease];
return rotatedImage;
}
I’ve not yet had the request to implement Push in an iPhone app, but a thread on the Developer Forums gave me a hint:
Some companies are already providing (or planning to provide) a gateway to the APN:
These are:
These are in closed beta:
Urban Airship and iLime also provide In App Purchase.
Or you can build your own: Open Source & Tutorials
I will try to keep this list updated.
Edit: added ApnsPHP & pyapns.org
Edit: separated the active services from the beta, added msgpush.com and C# Library
Edit: added a Rails plugin
Edit: added AppNotify (in Beta)
Edit: AppNotify is no more in Beta.
Edit: Added EasyAPNS source code
Edit: Removed Bigcurl HTTPush, since it’s reserved for bigcurl agency customers
Edit: added a Perl module
Let’s say you have an UITableView in which rows, when touched, changes the display to another view with an animation.
If you touch quickly a row, the row will highlight just before the animation starts.
If the action performed when touching the row takes some time (let’s say more than 0.5 seconds), after having touched the row, nothing will be visible while your code is running then the row will highlight and the animation will happen.
To make the row highlight immediately, so the user has a immediate feedback on its action, do this:
Change the name of your method
- (void)tableView:(UITableView *)_tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
to
- (void) didSelectRowAtIndexPath:(NSIndexPath *)indexPath
And add this method to your view controller:
- (void)tableView:(UITableView *)_tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSelector:@selector(didSelectRowAtIndexPath:) withObject:indexPath afterDelay:0.1f];
}
The feedback when touching a row is immediate and will greatly improve the subjective responsiveness of your application (IMHO).
(via the Instapaper blog)
The other day, I had to write a PHP script that reads a csv file of addresses and outputs the longitude and latitude of every address in the file.
Since I haven’t done a lot of PHP recently, I had to look in the documentation for the function that reads a file into an array because I couldn’t remember the name.
There is a reason for that: the name of this function is (take a deep breath):
file
Who can remember a function name that doesn’t relate to what it’s supposed to do?
In Cocoa, we have “arrayWithContentsOfFile“, and when reading some code, if you find
varName = [NSArray arrayWithContentsOfFile:someData];
Even with non-significant variable names as in this example, you can understand what this assignment does.
But when you read
varName = file(someData);
You have no clue, unless you code in PHP everyday.
I really can’t understand the logic behind the naming of functions in PHP.
Example:
Why do we have “utf8_encode“, “json_encode” but “urlencode“?
PHP is really teh suck.
PS: I do prefer Perl as a scripting language, perhaps because I’ve done more Perl in my life than PHP. I must admit that
@varName = <someData>;
isn’t clearer, but I do prefer it.
PS2: while ranting about PHP, I wondered what was the longest method name in Cocoa, so with the help of a Perl script, here are my findings:
MacOSX 10.5:
managedObjectContextsToMonitorWhenSyncingPersistentStoreCoordinator
67 chars, I’m glad to have auto-completion in Xcode.
iPhone SDK 2.2.1
willAnimateSecondHalfOfRotationFromInterfaceOrientation
Only 55 chars, still auto-completion is a must!