Archive

Archive for June, 2010

Objective Flickr on the iPhone

June 27th, 2010 4 comments

I have been working towards building my very first iphone app, and one of the challenges was to upload some images to Flickr. After much failure to create the signature that the Flickr API requires to authorise requests that flickr would accept, I was pointed towards ObjectiveFlickr, an Objective C library designed to ease the pain of working with the Flickr API.  This is a fantastic tool and has saved me endless headaches, however getting the library to work when in Device mode in XCode is a right pain in the butt. In order to ease any development pains that others might experience when using this library, I will now detail what I did in order to get everything to work.

After downloading the Objective Flickr library from github, I followed the instructions for adding the library to an iphone project as detailed in the documentation. I was most distressed when, after following the install instructions word for word, my app would not build. To check I was doing things correctly, I created a new project just to play around and test ObjectiveFlickr. Here the project built just fine and I could use the libraries with no problems. I went back to my original project, removed ObjectiveFlickr and reinstalled. Again, compilation errors.

"No architectures to compile for (ARCHS=x86_64, VALID_ARCHS=i386)."

As an iphone newbie, the compilation error did not immediately raise any warning flags so I hit our old friend google and tried to find out more about it.  After a bit of digging I found that this was actually the only bug raised against ObjectiveFlickr in the github project.  This is a problem that only raises it’s ugly head using ObjectiveFlickr when building against the device. The reason my test project worked was that it was building against the simulator. If I changed my target to the simulator then the project compiled. However I was using the camera in my app, which does not work in the simulator, so I needed it to work against the device.  The workaround from the ObjectiveFlickr site was this:

Build the objectiveflickr.xcodeproj project with changed settings "Architectures : Standard(32-bit Universal)" and then rebuild the project using objectiveflicr.

Turns out it’s not quite as simple as all that, so here was what I had to do, step by step, to get ObjectiveFlickr working in XCode building against the iphone device 3.1.3:

  1. Open objectiveflickr.xcodeproj in XCode
  2. Go to Project->Edit Project Settings and select the Build tab
  3. Change the Base SDK to iPhone Device 3.1.3
  4. Change the Architecture to ${ARCHS_STANDARD_32_64_BIT}
  5. Change the C/C++ compiler version to GCC 4.2
  6. Rebuild ObjectiveFlickr
  7. Return to your project
  8. Rebuild you project (probably best to Clean All Targets first, just to be on the safe side)

If ObjectiveFlickr does not compile after setting the Base SDK to iPhone Device 3.1.3, return the Base SDK  to Current Mac OS. Changing the compiler version from the LLVM compiler to the GCC compiler was neccessary because once I had recompiled objective flickr against the iphone libraries, when I then recompiled my project it complained that the LLVM compiler was not available.

error: can't exec '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2' (No such file or directory)

Turns out that for iPhone SDK’s 3.1.3 and below at least, the LLVM compiler is not available on the device. It’s available for simulator though, which is annoying to say the least.

This has highlighted to me one very annoying thing that I was not aware of before. Things that compile, build and deploy successfully on the simulator, may not compile build and deploy successfully on the device. Why Apple have not created the simulator to exactly simulate behaviour on the device is beyond me, but now I am aware of it I shall be careful not the be caught out like this again.

Spreading the hackspace love

June 14th, 2010 No comments

Last week I went on holiday to Devon as a wee break from the stresses and strains of work. And what a lovely week it was too; sunshine, beautiful scenery and cute country towns with hardly any wifi or 3G signal at all and an average population age of 70. After 4 days, my partner, Ian, and I decided we needed some life and some connectivity and headed up to Exeter to hang out.

Before we left, Ian had done some research and discovered a hackerspace existed in Exeter.  As one of the founders of the Brighton hackerspace, Build Brighton, we contacted Gray Simpson of E_hackerspace by email to let him know we were coming and asking if the group was holding a meeting while we were in the area.  Turns out the hackerspace was still in the ‘so, how the hell do we do this?’ stage of creation with no regular meetings, so an ad-hoc one was hastily pulled together on a Friday evening for our benefit.

It was really great to meet up with a group in the early stages of development. It really brought home what we at BuildBrighton have accomplished in less than a year and it was good to be able to pass on useful advice and tips to a new space. It was also fantastic to see how the stories that we had about building and running the space and about the cool things going on there inspired and enthused Gray and his co-founder Julius. I just hope that they hold on to that enthusiasm and keep the momentum going, which they will have to do to get the space off the ground.

I also learned that in Brighton we had it kind of easy. There was already a very strong tech community, albeit software and design based rather than hardware based, and as a visible member of that community I had easy access to forums, contacts and mailing lists that made the advertising and promotion of BuildBrighton fairly stress free. Exeter it seems has very little in the way of a tech community so Gray and Julius will have their work cut out for them trying to build one from scratch. I really hope they succeed and look forward to watching them grow over the next year.

You can find out more about the Exeter Hackerspace at their website or join their mailing list.  You can find BuildBrighton at The Skiff in Cheltenham Place every Thursday from 7pm, or by our mailing list and website.

To find out more about hackerspaces in general – communities for peeople into building things with technology – you can do so at hackerspaces.org