Categories
bitching dev-process fixing your desktop iphone programming

Unity: First impressions

I had to do some iPhone prototyping recently, and we had a trial copy of Unity to hand. I thought this was a great excuse to try using it. First impressions of the editor/IDE/environment – at least on OS X – are not good.

NB: In general, in terms of what can be done with it etc, I’m a fan of Unity. But I’ve never developed with it directly myself, and I’m now finding it surprisingly painful / steep learning curve.

Need to know basis

None of the built-in tutorials work, flat out, because the startup code has apparently changed substantially since they were written. The tutorials keep talking about things like “create a new project; by default it will X and Y and Z” but Unity no longer does any of those by default. Sadly, the tutorials don’t tell you how to get any of those manually – because, you know, they’re done for you by default, why would you ever need to know how to do them by hand?

File Association Theft

I was also *extremely* unhappy to discover a short while later that Unity has stolen the file association for PHP files. Under OS X (thanks, Apple) managing file associations is a surprisingly irritating business, as bad as with Microsoft Windows (Apple deems users too stupid to be allowed to simply edit associations – but applications are allowed to overwrite each other with absolute trust from Apple, and no user intervention allowed), so this is a pain to fix. In particular, I have an entire *suite* of applications and IDE’s for doing web editing, including a specialized high quality PHP IDE. Not any more; Unity has clobbered that with a crappy text editor that does nothing more than basic syntax hilighting. This is pretty offensive: firstly, don’t steal my files without asking, and secondly – give me back my IDE!

NB: I have no idea how it has done this, but Unity appears to have overridden OS X’s systems for file association management – following the standard procedure (e.g. here) has no effect, and Unity keeps stealing control of the files immediately that you confirm you want to give the assocation to some other app.

At this rate, if I can’t find out what it’s done to my OS and undo it, I’ll be uninstalling and deleting Unity with extreme prejudice in the very near future. Sure, this is partly Apple’s fault for assuming all apps are perfect and all users are not, but at a simpler level I just cannot afford to have a non-functioning development computer just because of one badly behaved application.

Categories
iphone

STFU: I have Skype on my iPhone

I’m interested: do I have this today simply because I happen – for the next few hours – to be physically in the United States of America, and so my IP address passed the iTunes store check and let me have it? I’ve been hearing that back home no-one can get hold of this little beauty. Muahahaha!

Of course, it’s a dirty little secret that Apple refuses to allow developers to see the comments of users for any country except the one the developer is currently standing in – so those hundreds of comments per-app that the developer seems to ignore, in your home country?

Yes, they are ignoring them, because Apple refuses to let the developer read them. Oh, how amusing.

Anyway, I just wanted to gloat over my posession of the free Skype app. I wonder if there’s some way I can start sharing it with people in the UK when I get home, phone-to-phone, without jailbreaking? Assuming, of course, that it really isn’t available in the UK iTunes Store (which I don’t entirely believe – why *not* make it available? After all, Skype is a European company in the first place…)

I can’t test over 3G/EDGE/GPRS because Apple has (I believe illegally) locked my iPhone and I can’t use it in USA for cell phone – but it’s working fine over Wifi. Unfortunately, I’m in San Francisco, one of the world’s worst cities for Wifi coverage (more to come on that later), so reception is painful and patchy – but clearly in any decent 1st world internet-connected city this is an awesome chunk of functionality.

Categories
amusing computer games design games design iphone

iPhoneSexGame … as an MMO?

I’m very tempted to make this:

http://gizmodo.com/5172615/iphone-os-30-will-turn-your-phone-into-a-revolutionary-sex-toy?skyline=true&s=x

…with particular emphasis on the social / avatar / chat / networking features.

Categories
bitching conferences funny GDC 2009 iphone Web 0.1

Need help – anyone in SF next week with an iPhone hardware unlock?

(seriously – otherwise I’ll be phoneless thoughout GDC :( )

I’ve had no interest in cracking my iPhone, so I haven’t.

Until I discovered the other day that my incompetent network (O2) won’t allow me to make calls in the USA on the agreement I have with them, so I need to use a local USA SIM while I’m there. Unsurprisingly, all O2’s own staff openly advised this as the only sane course of action. They were apologetic that this was necessary. O2 loses nothing if I unlock the phone.

And then I discover that Apple’s undocumented 2.2.1 update which I was bounced into installing has disabled all known unlock processes except for the hardware ones. If I had bothered to do the unlock a few months ago, it would have worked perfectly. Now, with less than a day until I leave the country, there’s nothing I can do.

Help? Anyone?

(NB: I’m not on a contract. I’m not even registered with the network. I’m sure the EU commission will sue Apple’s ass over this sooner or later and force them to stop retailing locked phones in the UK. That is of no help to me *today*)

(NB2: Apple’s lack of respect for their consumer continues to impress me every year. I know *why* they did it (network operators forced them to), but that doesn’t excuse screwing the consumer without warning them what you’re about to do to them. Undocumented updates are vicious)

Categories
iphone

iPhone OS 3.0: MMO and Games issues

…but if you want to make an MMO on iPhone, one of your first questions is going to be:

Am I allowed to sell virtual currency?

And the answer is:

No.

From the “revised” license agreement Apple requires you to agree to:

3.3.17 Only Paid Applications (which require You to enter into a separate agreement with Apple (Schedule 2)) may use the In App Purchase API. In addition:

– You may not enable end users to purchase Currency of any kind through the In App Purchase API, including but not limited to any Currency for exchange, gifting, redemption, transfer, trading or use in purchasing or obtaining anything within or outside of Your Application. For the avoidance of doubt, nothing herein is intended to prohibit You from offering for sale goods or services (other than Currency) to be delivered outside of Your Application.

– You may not enable the end user to set up a pre-paid account to be used for subsequent purchases of content or functionality, or otherwise create balances or credits that end users can redeem or use to make purchases at a later time.

Another big question is about the APN (push notification – lets you send messages to users of your app): what can you and can’t you do with it?

Apple seems to be taking leaves out of Facebook’s playbook here:

1.3 You understand that before You send an end user any Push Notifications through the APN, the end user must provide consent to receive such Push Notifications. You agree not to disable, override or otherwise interfere with any Apple-implemented consent panels or any Apple system preferences for enabling or disabling Notifications functionality. If the end user’s consent to receive Push Notifications is denied or later withdrawn, You may not send the end user Push Notifications.

2.2 You may not use the APN for the purposes of advertising, product promotion, or direct marketing of any kind (e.g. up-selling, cross-selling, etc.), including, but not limited to, sending any messages to promote the use of Your Application or advertise the availability of new features or versions.

That last bit is going to hurt a lot of people if it gets enforced – many developers would absolutely *love* to be able to do that.

It’s also a pain for the few apps that would have legitimate use for it. For instance, any Brain Game apps (which fundamentally *must* remind you to play every day – as the independent study in Scotland showed last year, they don’t really work if the user stops playing regularly). But within the constraints of the GUI that Apple designed and shot themselves in the head with (the notifications are very much “in your face” and annoying even just with Apple’s own App Store – and non-dismissable. ARGH!), I can see why they’ve done this; it would be a nightmare for the user otherwise.

EDIT: there’s some minor commentary + on Venturebeat already, but they don’t go into the details.

Categories
games design iphone

Here come the iPhone MMOs…

http://www.apple.com/iphone/preview-iphone-os/

Developers will have the tools to enable in-app purchases — like subscriptions, additional game levels, and new content.

Strangely enough, this makes things a lot easier for me. Now we can stop treading carefully around the “can’t use the revenue models we know and love and have been using for years” problem on iPhone and use all that knowledge we’ve already got.

I wait to get the new SDK and see how true to the promise the reality will be…

Categories
iphone programming

Using shared libraries for iPhone with multiple projects

You would think this is easy, seeing as how it’s an essential, simple, part of any programming project. HA! You obviously haven’t used Apple’s shockingly bad IDE (Xcode) much, have you?

You can read the extremely widely-linked blog post – http://www.stormyprods.com/blogger/2008/11/using-static-libraries-with-iphone-sdk.html – which is incomplete, and doesn’t work properly if you want to do auto-updates when source changes (which, in most cases, you do). Unfortunately, it doesn’t give any pointers to making linked projects work. I don’t blame the author for stopping at that point, their solution “works”, but I wanted to get the full benefits of auto recompilation.

You can google to try and find some documentation from Apple. I can’t find any, although I can find lots of other people on forums asking for documentation on how to do it themselves.

Eventually I worked it out, after hours of trial and error, and reading as much of the Xcode docs as I could find that seemed to relate to what was going on.

  1. Make a new project to hold your shared library
  2. Put all the .m and .h files for your library in that project (drag/drop them to the groups and files list)
    • XCode “feature”: it will by default fail to copy the files, even though that means everything will break later on, when you delete the originals. You need to tick the “copy files if necessary” checkbox)
  3. Create a “Static Library” build target
  4. Drag the .m files *only* to the static library build target’s “sources” twisty
  5. DO NOT DELETE THE FILES FROM THE MAIN PROJECT (because you’ve just created references, not copies, although it doesn’t tell you that … so Xcode will silently delete them everywhere, and OS X still doesn’t support undelete; Sulka tells me that Undelete will be coming to OS X in the next version. Oh, how I laughed)
  6. DO delete the files from the main Build Target
    • (again, they’re not actually files there, just references, so “deleting” them merely gets rid of the reference, not the file)
    • is this another bug in XCode? It seems strange that you use the “delete” funciton to do something that isn’t really a delete
  7. Click the NEW build target (the static library) and right click and select “build”.
    • XCode “feature”: if you highlight the thing you want to build, and hit Cmd-B to build, it WILL NOT BUILD the selected target, it will instead build the main target and ignore the target you actually wanted built
    • The *only* way to make cmd-b build the thing you want is to change some of the options on the Target dropdown at top left of the window – but you’ll have to change it back and forth each time you want to build somethign different with cmd-b … there seems to be no context-sensitive Build command in Xcode (bug?)
  8. If you want to test that your static lib built correctly (hint: you probably do)
    1. Add the static library to the main target
      • XCode bug: you can add the static library to the “direct dependencies” section. This has no effect; don’t do it. The static library MUST be added to the “linked libraries” section, i.e. the bottom panel of the General tab of the Inspector for the Build Target
    2. Write some code that uses your static lib – I suggest putting it in the app delegate class that Xcode auto-generated when you created the new project – and try building the main target (you CAN use cmd-b for this … unless you switched targets above, in which case you’ll need to switch them back first). If you have added the static lib in “the wrong place” or created it “in the wrong way” then this will fail with missing class errors etc

    All that has achieved is to compile your source code. No, seriously – it is THAT HARD. Now you have to actually try using it from another project.

    This is where the StormyProds link takes the easy way out (which only partially works): it simply copies the .a file (generated by the compiler) to somewhere on your hard disk, and has you hard-link to that file from other XCode projects. This will work; but it will also get out of date rapidly, and cause all sorts of bugs if you forget to update it. It will never auto-compile when there are changes.

    What Apple wants you to do (and for once I agree with them :) – this makes sense for most developers who aren’t using an external build system) is to link the projects directly, so that changes in one cause the other to automatically recompile *if necessary*.

    NB: for all my disappointments with Xcode, this is one feature I think has been extremely well done – it handles “links” between discrete Xcode projects extremely well, and (although the menus and docs for it are a bit hard to find) it mostly Just Works.

    1. Link the two projects
      1. Following Apple’s instructions here: http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/XcodeProjectManagement/040-Files_in_Projects/chapter_5_section_7.html#//apple_ref/doc/uid/TP40002666-CJBJHJCJ – i.e.:
      2. Open the project that will import the static library
      3. Go to the “Project” menu and select “Add to Project”
      4. Find the .xcodeproj file on your harddisk that representst the other project, and select it
      5. Check it worked:
        • At the top of Groups and Files panel, you should see a blue twisty for your project, and just inside it a blue twisty for your imported / linked project
        • Inside the second twisty MIGHT be a .app file (representing the main target of the imported project, which you won’t need – you MIGHT have created a project wihtout a main executable, or deleted the spec for it, but by default you’ll have this)
        • Inside the second twisty should be a .a file (representing the static library from the imported project, which you DO NEED)
    2. Make the secondary project import the compiled static library from the first project
      1. Drag the .a file from inside the second twisty, and drop it inside the “Link Binary with Libraries” section of the main Build Target of the main project
        • DO NOT drop it anywhere else in the Built Targets section – it will work, but will have no effect (you do that in the next step)
        • If you do it correctly, you should see the static library appear with the same icon as each of your included Frameworks (all iPhone projects have at least 2 Frameworks normally: UIKit.framework, Foundation.framework), and appear right next to them in the same twisty underneath Build Targets
        • ALSO open the inspector for your build target and add a second dependency in the main dependencies section to the static lib – NOT the app – from the imported project.
        • (if you don’t do this, you’ll see weird things like the build compiling for iPhone, but not for the Simulator, for no apparent reason)

    Finally … drag and drop the header files from the original project’s location in Finder into the new project’s source folders. Do NOT check the “copy files if necessary”. Xcode will do a reference / softlink, so that changes to the header files in the original project are picked up. NB: you will need to do a drag/drop each time you add a new header file to the original project.

    (You *might* be able to get away with putting all the header files in a sub-fodler of their own in the original project, and drag/dropping that FOLDER into the new project, but … I tried that, and it seemed to sometimes fail to notice the new header files, so I’m not sure I’d risk it).

    Some fun errors:

    Line Location Tool:0: “_OBJC_CLASS_$_ScoreUploader”, referenced from:

    Various causes of this useless error message:

    1. you added a class to the source project … but forgot to drag/drop that .m file into the “Compile Sources” part of the Target for the Static Library in the source project (or you did so, but you didn’t link your xcodeproj’s directly … but forgot to recompile the source project (linking the projects, as described above, triggers auto-rebuilds and you dont see this problem so often))
    2. you had all the source in one project originally … but haven’t deleted FROM YOUR HARD DISK the source files for the source inside the original, main project

    (this is IMHO another bug in Xcode: it silently leaves the files in place, by default, and yet silently (secretly) uses them when compiling – but ONLY when dealing with imported libraries, NOT when dealing with local compilation. Huh?)

    Line Location Tool:0: literal-pointer@__OBJC@__cls_refs@NSMutableList in libhiscorelib.a(XMLSuperParser.o)

    You haven’t added the static lib as a non-lib dependency

    Some things to be aware of

    The header files that you drag/dropped from one project to the other have NOT been copied to the new project and are therefore NOT real files – they are references.

    If you delete the original files (in the statically compiled lib project) then the references in all other projects will vanish; be careful!

    If you updarte the original files (in the statically compiled lib project) then the referneces in all ohter projects will automatically update (with no UI indication of this).

    Unlike most normal IDE’s, there is no obvious UI indication that the files are not inside the current project (you can check by doing cmd-i on any of the files and looking at the value of the “Full Path” field, but otherwise you won’t see a difference).

Categories
agile games design iphone programming recruiting

iPhone Creators: Brighton pub meet March 9th

http://upcoming.yahoo.com/event/1917163/?ps=5

If you have any interest in iPhone development (you have ideas for apps, or you want to start coding for your iphone, or just want to meet other like-minded folks over beers), then come along.

Bring friends. Bring iPhones (I’ll bring my laptop so you can download and try my current work in progress)

If you’ve got anything you’ve made yourself, definitely bring it along!

We had a quiet first meetup last night, I’ll be adding screenshots / app descriptions for the two apps shown on the night to this post later.

EDIT:

Snooker Scorer

snookerscorer1 This is a simple app that keeps score of a snooker match. You can use it in a club, watching a match live or even following on tv.

Just tap the ball that has been potted. Hit the ‘swap’ icon to swap players. If a foul happens, hold the ‘foul’ icon and tap the ball fouled. Free balls can be added as well through the popup actions icon.

Future additions will make the information line adapt to show the most relevant info such as current or maximum break, difference and points remaing, balls potted in current break, match history, undo mistakes, and whatever else I can think of.

Categories
iphone programming

High Score Server for iPhone (free)

I’ve made a highscore system for iPhone, complete with registrations, email confirmations, global highscore board, and iPhone client-side rendering.

I’d like to make it available as a free service (it’s live already, and included in a game I’m about to publish). I’m looking for volunteers who want to try integrating it into their games.

If you are such a person, or know someone, drop me an email (adam.m.s.martin at gmail).

A couple of very basic screenshots to give you an idea of what it does at the moment:

Admin features

In-game UI

(I’m not sure how much of this I’ll put in the download, but I’ll at least give you working sourcecode for it all and you can customize the UIView instances to display whatever you prefer)

Categories
bitching iphone Web 0.1 web 2.0

Web 0.1: Apple: please hire some web developers

I can no longer develop iPhone Apps. I am on my eighth attempt to download the 1.75Gb 2.2.1 SDK – without which, XCode refuses to even talk to my iPhone any more, because I allowed the iPhone to upgrade.

EDIT: I have it! I HAVE IT! YES! NO MORE PRAYING TO THE GODS OF ****ING APPLE’S CRAPPY WEB SERVER! (it’s probably a corrupted download)

The problem?

Sheer mind-numbing incompetence by Apple’s web team, it would seem (NB: I may be wrong; I haven’t tried packet-sniffing the HTTP traffic to prove this beyond all doubt, but my experiments with different browsers and different ISP’s strongly indicate it is the case). They’ve (mis)configured the webserver over at developer.apple.com to kill partial downloads of this monstrous file.

If you cannot download the whole thing before Apple automatically logs you out of their website (which they do every half an hour or so if you don’t actively surf the site), then your download is cancelled, server-side. You cannot resume from where you left off (their web server refuses to honour the HTTP command that tells it to resume a partial download).

What did they do wrong?

It’s a session-management problem – you CAN pause and resume a minute or two later. Just not half an hour later.

The other major bugs in the Apple websites (including that force logout!) suggest that some novice web programmer made a half-assed Session-management system that, well, sucks. (am I sounding angry? Hell yes; Apple’s website is behaving like some naive bricks-and-mortar company from 1999, not 2009). Or maybe they picked up a 3rd party one … that sucked. Whatever. It seems the session-manager is overriding Apache’s built-in support for this core element of HTTP, and saying “no”. For no reason other than bad web coding.

In passing, I noticed that they are *still* (allegedly – it’s easy to fake) running the same version of the Apache webserver that they’ve been shipping by default with OS X Server for some years now – a version that is more than 4 years old, 8 versions behind the current “maintenance” release, and 1 major version behind the “mainstream” release. Personally, I wouldn’t run Apache 1.x if you paid me, not with 2.x out there and running a “proper” webserver arch (apache 1.x is not a real webserver, it’s a hack using forks that makes it unnecessarily slow under heavy load).

</rant>

Categories
bitching iphone

Apple & a study in frustration

Half way through the insane 1.75 gigabyte download of iPhone SDK 2.2.1 (which, lets be honest, has precisely 200 megabytes of content, and 1,500 megabytes of STUFF I ALREADY HAVE; Apple’s engineers apparently have never heard of the 30-year-old concept of a “patch file”), Apple refuses the download.

I “no longer have read permssions to that URL” according to Safari. This is despite being logged-in to Apple’s developer.apple.com website. The same website that FORCE logs out everyone *at least* once an hour (because Apple’s web developer team have miserable lives, and want to share their pain with everyone else).

The same website that has given me “error: this page requires you to be logged in”-type errors trying to load … the login page (I’m not kidding, it’s 100% reproducible in Safari and in Firefox, quite easy to trigger. Seriously weak web-server code going on there).

So, let’s start that 1.75Gb download *again*. Apple: I detest you. Especially because you know the problems you cause, and build it into your marketing campaigns; it’s not cool, it’s not funny, it’s pathetic. Why can’t you employ some competent web developers? Why, when you like to call yourselves paragons of UI design, do you make the iPhone App Store have a GUI that would look “weak”, “poor”, “stupid” and “ugly” in 1999, let alone 2009? What happened?

Sigh.

Categories
dev-process iphone programming

iPhone Development FAQ

In my joyous travels developing a fun little iPhone game recently, I kept track of all the many tips and tricks and gotchas I came across. There are a fair few bugs in Apple’s IDE (including at least one critical one that bit me), some stunningly bad flaws in the Objective-C language (it’s *horrible*), and some slightly surprising lack of docs from Apple in key areas (like: how/when do I get paid?)

There was too much to blog it all, so instead I installed a free FAQ software and I’m gradually transferring my notes over to this FAQ (only got a few questions in there at the moment, just fresh installed):

http://iphonefaq.t-machine.org/index.php?action=show

(the one you probably want to start with is: How to make applications for the iPhone?)

There’s an awesome feature to this FAQ too (not that I’ve tested it): anyone can go to the site and click “Ask a Question” and it gets added to a list for admins to answer and post. You can even answer your own question at the same time as asking it.

If you’ve been developing iPhone apps yourself and have some burning questions or neat tips of your own, feel free to go to the FAQ and add them in. Any problems, email me (email address is on the About link at the top of this page)

Categories
community facebook iphone web 2.0

iPhone App Store: Social Network and Game Portal

The App Store is just another casual games distribution platform + social network. You can pretend it isn’t (sometimes I think Apple is still pretending that it’s just an extension of iTunes, and ignoring the social side completely – Doh!), but that doesn’t make it true :).

Apple’s had the iPhone version of the App Store running for more than half a year now, and made tens of millions of dollars from it, so what’s it like? Where’s the social stuff good and bad? Where’s the game distribution stuff good and bad?

Categories
games design iphone programming

My first iPhone game – download now!

As part of our super top secret new startup we’ve been making some educational games, and for fun (in my spare time) I tried porting one to my iPhone. It’s a simple maths game which I thought would work well with a touch-interface. If you have an iPhone, you can get it here:

Download from Apple iTunes Store

(this is a bit of an experiment – if enough people like the game, I’ll take the time to plug it in to some serverside stuff we’re doing which will add a bunch of feedback/stats/scores features for anyone who’s got the game)

Categories
dev-process iphone massively multiplayer mmo signup processes programming

iPhone: why’s my download stuck at 1.4 of 1.6 Gb?

Your possible answers include:

1. Because … Apple engineers have never heard of the concept of a “patch”, and require you to re-download the *entire IDE*, with all libraries, all documentation, all binary code – everything – when they release an update? So the current “SDK” for iPhone (hint for Apple: when most people say “SDK” they don’t mean “plus a copy of a bloody operating system”, they just mean “the few custom bits that are specific to that app”) is a whopping 1.6Gb?

[NB: actually in general I think that’s a good thing – avoids a lot of mis-configuration / version mismatch problems – but as an MMO developer the idea of *not* patching gigabyte-sized packages horrifies me, and avoiding those problems actually isn’t THAT hard (it’s been solved many times by now!) these days. Writing (or buying) a good patcher is one of the first steps you do in MMO dev projects…]

2. Because … Apple didn’t think to split The Behemoth into multiple files, perhaps make them something reasonable, like a few hundred meg each?

3. Because … Apple decided to put this monster behind an authentication check on their website, presumably for legal reasons, and there is no other “official” mirror (all the ones you find on google are technically-illegal torrents or else, ultimately, redirect you back to the apple.com link), and their authenticated sessions TIMEOUT after 1 hour of “not fetching any new pages from the site” (completely ignoring whether you have any transfers in progress!), and refuse to send you data once your authenticated session runs out?

4. All the above?

NB: I wasn’t brave enough to try resuming the downoad without first re-authenticating and loading at least one web page from the apple developer site to prove I was logged in. I suspect (*suspect*) that the web browser would receive an HTTP 300 redirect to the login page, at which point most browsers are going to delete the partial download. Ha. Haha. HAHAHAHAHAHAHAHAHAHAHAAARRRRRRGHHH!.

Expect to see some comments/tutorials/advice on iPhone game development here at some point in the near future. If I can ever get the download to complete…