Thread safe database with FMDB (SQLite) as alternative to Core Data

.

The apps I developed recently required saving and loading thousands of objects within a very short time on multiple threads, mostly for reasons of caching and offline mode support. I started implementing this behavior in Core Data, which caused a few problems related to thread safety and performance.

I tried using FMDB as an alternative to Core Data, which works surprisingly great. There is not much information about multithreading and thread safety available, that's why I'm writing this blog post.

To apply the MVC principal, I assume you create a class just for reading/writing into/from the database. You should never access the database directly from outside of it.

After trying different approaches of multithreading, this turns out to be the best solution for my projects.

First of all you need a database queue (provided by FMDB), an NSOperationQueue to queue your queries and a lock for the database.

If you use a singleton for your database, set up your static variables.

Basically there are 2 use cases now: Read from database and Write to database

To read, all you have to is:

To write into the database, you have to use the writeQueue:

That's all you need to really easily save/read data using FMDB. I use a little wrapper that matches properties with the according columns inside the database.

Bikemap 3.0

BikemapMini

The first version of the Bikemap iPhone app was released a few years ago. It was developed using Appcelerator Titanium back then. The new Bikemap app was designed and built from scratch. It's really fast and has a lot of nice new features like tracking of a biking route right from the iPhone.

Download Bikemap

Wifimap - iPhone App

The free WiFi Map app helps you finding free Wi-Fi hotspots next to you or in a specific city.

It is also possible to download all available Wi-Fi hotspots for offline use.

Download Wifimap

TSMessages

iNotificationWarning

After open sourcing my first piece of software on GitHub (iOS-Screenshot-Automator) I decided to open source another component. It's called TSMessages and allows the developer to easily display little Notification/Messages on the top of the screen without stopping the user interaction. (similar to Tweetbot)

The notification moves from the top of the screen underneath the navigation bar and stays there for a few seconds, depending on the length of the displayed text. To dismiss a notification before the time runs out, the user can swipe it to the top or just tap it.

There are 4 different types already set up for you: Success, Error, Warning, Message (take a look at the screenshots)

It is very easy to add new notification types with a different design. Add the new type to the notificationType enum, add the needed design properties to the configuration file and set the name of the theme (used in the config file and images) in TSMessagesView.m inside the switch case.

Take a look at the Example project to see how to use this library.

Check it out on GitHub: https://github.com/toursprung/TSMessages

With over 2.400 Favs on Github it's in the top 100 Objective C repositories on GitHub.

Wandermap

Wandermap is a free iPhone app to find the best hiking routes around you. Download it from the AppStore for free: Download There are many nice featured included like a synchronised route collection between devices and the web version and offline support.

YouthHotSpot

YouthHotspot is the perfect app for your next trip to Germany. You have access to free WiFi hotspots and hundreds of tips for bars & cafés, shopping, festivals+ over 80 vouchers. The app works completely offline from the first app start on.
 
You can download the app for free from the AppStore. The app is also available on Android.

 

Automatic screenshots for iOS apps

I guess all iOS app developers know this problem: You have to take (usually 5) screenshots of the app for all devices (iPhone 4, iPhone 5, iPad) in all supported languages for every update and every app. When I was working for 6Wunderkinder  we pushed an update with 30 new languages for iPhone, iPad and the Mac. That means we had to take and upload 30 (languages) * (2 (iPhone) + 1 (iPad) + 1 (Mac)) = 120 screenshots.  

Recently I've been working on a script that automates taking screenshots and saving them properly. It is based on UIAutomation. It navigates through your app and takes all needed screenshots automatically. That means you have to write Javascript code for UIAutomation to control your app and take the screenshots.

The scripts can change the language of the iOS simulator and set the system language. All you have to do is define all needed languages and devices types in the run file.

After some developers asked about the scripts I open sourced it on GitHub: https://github.com/toursprung/iOS-Screenshot-Automator

EDIT: Try out the new version, which is based on Ruby instead of Apple Script: https://github.com/KrauseFx/rScreenshooter

Runmap, Wandermap for WP

Recently I've been attending the Hackathons hosted by Microsoft Austria. It's a really cool office with all the things you need as a developer. I worked with my colleague Reinhard Hafenscher on Wandermap, Runmap and Bikemap for Windows Phone 7 + 8. The first two apps are already released in the Windows store.

Runmap

With the free Runmap app you can access over 80.000 running routes worldwide instantly. Automatic listing of all routes near your current location, interactive elevation profile, synchronization of your personal route collection and much more. For more information open the download link.

Wandermap

Didn't you always want to visit the lovely Austrian alps? Then this app is perfect for you. Find over 28.000 hiking routes world wide. This free app has the same awesome features as the Runmap WP app.



Botball 2012

Since we are the winners of the European Botball Robotics competition, we took part at the Global Conference on Educational Robotics. This was our first year taking part at Botball.

After 5 exciting and interesting days we won the following awards:

  • Outstanding On-Site presentation (100%)
  • Outstanding Programming
  • Spirit award
  • Finalist

Next year I definitely want to take part in this awesome conference and competition as well. I talked with many smart and interesting students and mentors there 

More information can be found on our blog: 

http://puzzles-gcer.blogspot.co.at (German)

iTanky

iTanky is a fun and addictive 2 dimensional tank game for iOS. You can either play the campaign or fight against your friends via Wifi or Bluetooth. I developed this app together with Richard, a your graphic designer from Dresden, Germany. I also developed a web based map editor that works on all modern browsers. This app is completely free available here: AppStore

Check out the project website: http://itanky.com

A far more detailed project description can be found here (only german): iTanky Projektbeschreibung

6 Wunderkinder

Bikemap App Sport ranking
Bikemap App Sport ranking

Hi everyone!

Hopefully you are already aware of my Bikemap App. It was downloaded over 50.000 times within 4 months, a huge success for me and I couldn’t have done it without you!

Some quick facts:

  • I scored second place with this app in the U19 freestyle computing competition and was chosen from over 650 participants
  • I was in the Futurezone.at, one of the most famous IT-blogs from Austria
  • The Austrian Kurier wrote about this app in the printed version
  • Bikemap was the most downloaded sports app in Austria, Czechia and Qatar
  • Sebastian Kreutzberger, the CTO of 6Wunderkinder, noticed this app and offered me an iOS developer position.

Wunderlist and Bikemap were both developed in Titanium and one day I decided to tweet to Appcelerator announcing my recent number of downloads. Sebastian noticed my tweet and quickly got into contact with, we chatted and then he offered me a job. 6Wunderkinder is a totally cool company, and you can see this by the people who work here.

tweet-weswegen-ich-zu-den-Wunderkindern-komme

Before I started working, I participated at a Appcelerator Titanium Training to become a Certified Titanium Application Developer. It was a huge milestone in my young career and I hope to gain more training in the future.

6Wunderkinder is a Berlin based startup founded in August of 2010 and creates multi-platform productivity solutions for individuals, groups and businesses. Currently I am working on a productivity platform named Wunderkit. Recently, I submitted an update of Wunderlist for iPhone and iPad to the App Store. I also worked on the next Wunderlist version that includes iOS, Mac and Windows. This week I started to work onWunderkit projects and look forward to the upcoming challenges. I have the greatest team that provides good support, feedback and lot’s of laughter.

How to fix "OSStatus error 2" Time Machine Error

OSStatus Error 2

When you want to use your WD-MyBookWorld as a Time Machine Backup, you'll probably get this error: The operation couldn’t be completed. (OSStatus error 2.)

To fix it, you have to login with your WD_Backup User.

Go to your MyBook World Website (via Bounjour) and go to "Users". You'll see the the "WD_Backup"-User. Set your own password and use this login data in your Mac Time Machine.

Bikemap

Bikemap iPhone App

The Bikemap 1.0 iPhone app is available for free in the App Store. With this app you can access over 1.000.000 biking routes world wide. There are many nice features like filtering routes, sharing routes on social networks and syncing of the personal route collection between the web and the Bikemap App.

It was developed by using Appcelerator Titanium and was downloaded over 200.000 times within 1 year.

Route details with elevation profile

List your own route collection

Chatbot

iTalk

I developed a german speaking Chatbot webapp for the iPhone. It learns when you chat with it and saves your answers. It doesn't use any graphic files, only CSS3 properties

Golfstats

In 2009 I wrote some scripts that automatically download all results of golf competitions in Austria and saved it in a database.

After that was finished I developed many stats and analysed the data to calculate where to play to get a better handicap in a specific region.