Posts Tagged 'Programming'

Tip: CACurrentMediaTime

Here’s a subtlety of time-based computation that you probably aren’t (well, we weren’t) aware of on the iPhone: Chances are that you’re using CFAbsoluteTimeGetCurrent or its wrappers like [NSDate timeIntervalSinceReferenceDate] for your time snaps … and that is actually not good practice!

See, those functions return clock time. Clock time is synchronized, unpredictably, with the network time signal. So if you’re looking for a reliable timer for in-application events … that’s not it! Discussion here if you’re on the dev forums, but the solution is simple: Use instead the Core Animation function CACurrentMediaTime, which we hadn’t noticed before but apparently takes care of the tricky bits in converting mach_absolute_time() into seconds.

So if you’ve noticed any weirdness in your timing, or if you have something that could be hopelessly confused by clock synchronization turning your “elapsed” time into a negative value, or the like … best to make that switch now!

h/t: 71^2!

Continue Reading →
2

Tip: CodeSign FAIL

Here’s a little tip we stumbled across whilst digging into that Facebook thing, which we haven’t run into ourselves but would be handy to know when we do:

Okay, so you’ve spent months working hard on your iPhone project, and you finally go gold. You get sign off from your client, you’ve squashed the last of your bugs and you think “I’m ready to submit this bad boy!”. You package it up for release as per Apple’s instructions, and then try and upload it using the Application Loader that Apple supplies.

Then you get a message from the Application Loader:

Application failed codesign verification.

What the?? If you check the activity log you also see the following:

A sealed resource is missing or invalid

Yep, sounds like the kind of “helpful” message you get when things go wrong. And what is the solution? Why here you go:

After countless hours trawling Google and finding nothing, I worked out that I needed to do two things:

1. Remove all files from the project that started with ._ (dot then underscore). See my previous post for more, however you just open the terminal and run find . -name "._*" -print0 | xargs -0 rm -rf from the command line in the root of the project

2. Make sure that the Icon File setting in the info.plist file is empty

After making these two changes, and rebuilding my project (make sure you do a “clean all”) it submitted to Apple without problem. I really hope that helps someone…

Handy if you need it!

Continue Reading →
0

Library: jQTouch Beta

And a little something for our web developer friends today: if you’re into jQuery — and seems everybody is, these days — there’s a plugin called jQTouch for your mobile WebKit programming needs, and sounds like the new beta version is indeed all that and a ham sandwich:

Just wanted to let everyone know I just released a new beta for jQTouch — a jQuery plugin for mobile development, similar to iUI. The new beta has a ton of features like native animations, event callbacks (including swipe detection), and a ton of shortcuts for creating fullscreen apps.

Pretty impressively updated from our first mention back in March … enough we figure to merit a reminder in case you weren’t bowled over back then!

h/t: iPhoneWebDev!

Continue Reading →
0

Source: AppReviews

Here’s a handy open-source application for the busy little iPhone programmer:

AppReviews is a tool for iPhone and iPod touch developers, allowing you to keep track of how your applications are being reviewed and rated by users across all of the iTunes App Stores worldwide…

AppReviews is open-source, the source code is available on github. You will require a copy of the iPhone SDK from Apple in order to compile the source code.

Very helpful, very nice, this fellow couldn’t get Apple to approve it so he open sources it … but wait! The plot thickens!

Today I discovered that there is a recent app in the App Store also called AppCritics, which also scrapes review data from the AppStore. I was doubly shocked by this because:

1) I submitted my AppCritics to the AppStore on 30th November 2008 and it was finally rejected in January 2009 because it scrapes data using a non-public web API (the same API iTunes uses). So how come this new app gets approved when it does the same thing?

2) I thought that I “owned” the name AppCritics in the AppStore because I still have the rejected app in my iTunes app listing, with a button that says “Resubmit Binary”. So how can someone else come along and submit an app with the same name, that does the same thing, and get approved?

This is yet another example of how inconsistent and poorly run the App Store still is.

I am emailing Apple about this matter now, I doubt that I will get any meaningful response beyond some canned auto-reply. In the meantime I will be renaming my AppCritics to AppReviews instead.

Heh. On the one hand, at least he GOT a rejection, instead of 110+ days in limbo like our Forgotten Project™, but really, approving an app that does the same thing with the same name … now, that’s just rubbing salt into the wounds, isn’t it?

h/t: LinkedIn – Cocoa Touch!

Continue Reading →
0

AdMobWhirl

Why, things just keep hopping on the iPhone app advertising scene; you may recall the little AdMob vs. AdWhirl brouhaha we mentioned a while back that the general consensus was didn’t make AdMob look either competent or honest. Well, the decision of which to pick between those two for your advertising is now very much easier indeed: AdMob’s going with the if you can’t beat ‘em buy ‘em policy! From the AdWhirl blog:

Dear Developers,

As you may have already heard, we’ve been acquired by AdMob! In keeping with our values of transparency and openness, AdMob is open sourcing AdWhirl (both client and server) within the coming weeks. Not to fear, this means absolutely no changes to the functionality or support you have come to expect from AdWhirl and you’ll get full support for AdMob ads (coming soon). In addition, we’ll keep working hard on our roadmap w/ more features to help you guys succeed in the AppStore!

Interesting, that. What AdMob has to say is

Offering an open source solution will enable us to ensure advertisers and publishers a high quality experience with mobile advertising and publishing, and introduce an open, transparent choice into the market which has not existed to date. The open source solution will be available for all iPhone app developers and advertising networks, whether they currently work with AdMob directly or not.

One could be forgiven just a tad of skepticism regarding AdMob’s intentions here, though, so perhaps keeping an eye out for other mediation solutions might be time well spent. Not that we know of any other big ones (Tapjoy doesn’t seem to count as big) except Mobclix — you’ll let us know if we’ve missed others no doubt — and they are stoking the skepticism:

We would like to emphasize Mobclix’s continued dedication to being an open, neutral, and transparent ad exchange for the benefit of our developers and our ad networks. Our ad exchange offers developers complete transparency and performance, connecting them with the leading ad networks in the space – including Quattro Wireless, Videoegg, Millennial Media, Jumptap, Smaato, mDOTm, and others.

Mobclix always puts our developers first and chooses ads based on eCPM, not on a special preference to any one ad network. Mobclix believes that an open platform that is unbiased towards any ad network, such as we provide, is best for developers…

So there you go. AdMobWhirl mediation, Mobclix mediation, Tapjoy mediation, or any of the specific networks and other various players we try to keep track of here? What’s working out for you, Dear Readers?

h/t: iphonesb!

Continue Reading →
1

Posting to Facebook

So let’s say you have a client who wants to post to Facebook from their iPhone application. You could probably find on your own the official SDK here,

Facebook Connect for iPhone

but here’s a few additional resources to help you along:

RaddOnline: Using Facebook Connect for iPhone tutorial is a nice introduction if you’re completely new to this Facebook app creation thing. (Or to Facebook, period, like those of us who actually do useful things with our time…)

Mobile Orchard: Marketing In Code, Part 1 is worth a gander to judge its claims about Facebook being an effective marketing method –

One status update or feed story to 13 average Facebook users users generates the same exposure as spending the entire post-commission revenue for one app priced at the average of the top-100 paid apps.

– but Part 2: Setting A User’s Status In Facebook From An iPhone App is where the step by step instructions are, along with a set of helper classes that can be found on github.

Posting Links to Facebook Profile from iPhone Code shows how to elegantly — excessively elegantly, even the author suspects:

I guess that’s precisely the thing: there is just so much code there for such a little thing! Two levels of delegation, six separate files, and so on. It’s hard to escape the feeling that we let some unnecessary architecture astronautism enter our heads when doing this.

extend the MobileOrchard helper classes from immediately above to deal with the Links.post Facebook API.

and if the above doesn’t sort you all out and you need to ask a question, this is probably the right place:

Facebook Developers Forum >> Mobile and Handheld

So there you go: all you need to get your Facebook integration nice and smooooooth, we trust!

Continue Reading →
7

Snow Leopard Development Stacks

Just in case you were wondering, here’s a rundown of project versions you’ll find in the Snow Leopard GM:

After some digging, it appears that Snow Leopard (Apple’s latest OS X release) includes quite the refresh of web development stacks.

One update that is particularly exciting is the inclusion of PHP 5.3 which is fantastic for PHP developers as this release marks a major milestone in the progression of the language…

  • Apache 2.2.11
  • Java 1.6.0_15
  • Perl 5.10.0
  • PHP 5.3
  • Python 2.6.1
  • Rails 2.2.2
  • Ruby 1.8.7
  • RubyGems 1.3.1
  • SQLite 3.6.12
  • Subversion 1.6.2

All looks pretty much up to date, or at least of respectable vintage, yes?

Also take a gander at 23 Snow Leopard Tweaks You Didn’t Know About for some handy tips not generally known, at least by us … specifically, how to boot the 64-bit kernel!

h/t: DZone!

Continue Reading →
0

Snow Leopard lives!

Just in case you managed to somehow not be expecting this, as of just now Snow Leopard developer documentation, sample code, and Xcode 3.2 download are live at

http://developer.apple.com/mac/

and there seems to be quite a revamp of the reference library to go with it:

http://developer.apple.com/mac/library/navigation/

There was notice on the lists that Snow Leopard NDAs are now lifted, so … well, actually we don’t have anything Snow Leopard specific we were keeping secret, far as we know all our projects were compatible with only trivial tweaking here and there. Compatible enough that we’re not going to jump on the upgrade bandwagon immediately, we’ll give it a couple weeks and see if any massively widespread freakouts become apparent in developer land either iPhone or desktop. But if you’re ready for the bleeding edge, there you go!

[UPDATE: Heh, that was quick — already an issue that would have been a problem for various domains of trolldom showed up on cocoa-dev:

Here’s the problem. Snow Leopard ships with OpenSSL 0.9.8, with a universal 0.9.7 and PPC32-only 0.9.6 thrown in for backward compatibility reasons. The 10.6 SDK comes with the headers for 0.9.8, but not 0.9.7.

So if you need to use libcrypto 0.9.7, you must use the Leopard or Tiger SDKs. You can’t use the Snow Leopard SDK and libcrypto unless you want to make your software require Snow Leopard. (You could try moving and linking things around, but then who knows what you’ll break…) If this is going to be a problem, then you might want to consider using an alternative cryptography engine.

Righty then. Apparently it will be a little while before we move our operations wholesale over to Snow Leopard!]

Continue Reading →
0

Library: Bing SDK

Hey, if you have warm snuggly feelings about The Beast From Redmond and their so far underachieving Bing search engine, have we got a treat for you today: there’s now an open source SDK for your iPhone programming joy!

The Bing SDK for iPhone and Mac is a Cocoa Framework which enables Mac and iPhone developers to easily integrate Bing search results into their applications.

The SDK was designed to remove the headache of manually having to parse XML or JSON in order to communicate with the Bing API.

The SDK Provides:

  • Synchronous or Asynchronous querying
  • Access to Web, Image, Video, News, and Phonebook source types
  • Potential to easily add dynamic search results to all of you applications!

Not too sure why this is more interesting than [insert your favorite metaphor for uselessness here], but hey, if there’s some reason you’re not down with all the Google Mobile iPhone compatibility work, then perchance this would indeed be just the ticket.

h/t: electronista!

Continue Reading →
0

Snippet: Playing YouTube Videos

So it’s very easy to play a video in your iPhone app — whether local or off the web — with MPMoviePlayerController; and it’s very easy to put a video on the web via YouTube. However, there is a problem combining the two; since YouTube doesn’t give out direct links to its videos, you can’t give a YouTube video to MPMoviePlayerController. And if you tell the system to open the URL, well then your app’s gone. A non-optimal experience, indeed.

But here’s a way around that — just have a UIWebView containing nothing but the EMBED code for the link you want to pull up, and it’ll show up — once it loads, so you do have a white flash while you wait — as a YouTube brand, play button, and frame from the video. When the user taps that, the YouTube application is launched on top of your app, and when it’s finished, control is returned. Not bad on the convenience, indeed.

Unfortunately, there’s no kind of direct control or notifications of loading, progress, quitting, etc. However, you can get some indirect notifications based on your application’s window state: add in your view controller

[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowVisible:)
name:UIWindowDidBecomeVisibleNotification
object:self.view.window
];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(windowNowHidden:)
name:UIWindowDidBecomeHiddenNotification
object:self.view.window
];

to get these called when the YouTube window is shown and goes away respectively.

- (void)windowNowVisible:(NSNotification *)note
{
twlog("YouTube window went away");
}
- (void)windowNowHidden:(NSNotification *)note
{
twlog("YouTube window took over");
}

and hey, if that’s all you require by way of notification you’re good!

Now, if some clever spark out there would tell me how to set up the HTML delineated in that article so it would actually display an image of my choice instead of what comes from YouTube, then I’d be really happy! Bueller? Bueller? Anyone?

UPDATES:

HCYoutubeParser: Class which lets you get the iOS compatible video url from YouTube directly!

Continue Reading →
2
Page 74 of 93 «...5060707273747576...»