Jills blog Jills blog – of technology and everyday life

iPhone development

Since I have been working with iPhone development the lasts months, I will try to give a quick summary of my experiences so far, while still fresh in memory. I will not get into what you need to do before getting started, that´s another long story :) But you need an iPhone Developer license and a mac and the iPhone SDK setup and installed with XCode. And you need to learn Objective C which is the coding language. It may be a though start, but dont give up! A good starting point for learning is the Standford University iPhone Application Development podcasts on iTunes, or just check out this guide to all resources you need.

Some challenges

Storing photos
The iPhone sdk doesnt always provide us with the same functionality as found in the built in apps from Apple. One issue was that we wanted to use the camera from our application to take photos and store it in a photo album on the iphone with geotags. First problem: there is no way to create a new photo album by from an applicaton, so we had to store to the camera roll. Next: geotags EXIF data are stripped off photos when saved by UIImagePickerController into the photo library. Even though the geotags are provided by the camera by default. There may be workarounds, but I didn’t find a good and easy one. We could have stored the photo in the application document folder, but then we have to make our own gallery displaying the photos and methods to send it outside the iPhone. And there is no way to reference a photo in the camera roll from the application. So we couldn’t find a way to match a photo from our application with the iphone library, nor a way to delete it from the library after storing. In this first version of the app we ended up storing photos in the photoroll so the photos is available through iTunes. Next version needs improvements. One way could be to use a 3party photoview component, for example checkout the three20 and photoviewer component, also used by facebook.

Understanding gps and location accuracyimg_0065
Determining the location is done by the Core Location framework. The location manager is the main responsible for polling location data and is pretty straightforward to work with. But the technologies used to deliver locations is hidden from your application. There are 3 possible ways to determine the position: GPS, cell tower triangulation and Wi-Fi positioning service (WPS). GPS is most accurate and WPS may be least accurate, depending on how much location data is registered in  your area. WPS is using the IP address from the iphones wi-fi connection to look up in a large database of known service providers (mathing MAC addresses). Which method the iPhone uses to determine the location you as a developer have no control of, but it will use the best method available. You can specify a desired accuracy setting on the location manager. But be aware of that a greater degree of accuracy will use more resources (battery). In this application we needed high accuracy, so the accuracy was set to 10m. But still we had problems getting accuracy, sometimes it was far off! When you start the location manager with startUpdatingLocation it will poll for new locations until you call stopUpdatingLocation. You should stop polling as soon as you got the accuracy information the application needs. The first response from the location manager is usally a cached location, the next is more accurate, the third is usually very accurate. But you have no control of how many responses you will get and the responses may be received non cronlogical in time.  So check the timestamp on the received location. Also check the properties horizontalAccuracy and verticalAccuracy on the location object to see if the last location has a better accuracy than the last one, and then store it. If you have received the accuracy you needed than stop updating, if not keep looking and set a timeout. This method made our location pretty accurate! But still, testing with different iphones, made different results so you can not guarantee it. While testing it is always a good idea to check the position on the buildt in map application, if that one is more accurate than yours, than probably you can do better too.

Interface Builder
IB is a visual editor for developers to create user interfaces and is a part of Xcode. The interface file is saved as a .xib file. Its pretty simple to work with as you just can drag and drop elements onto the stage. To connect events and map the elements to your code everything is done visual by dragging connectors. A bit tricky in the start if you never used this tool before. I started developing using IB but was told by other experienced developers that they would not use it! But as I often experience, some hard core developers often has this attitude and like to hate everything visual :-P so I had to take a closer look at it. There are lots of debate on the internet about why or why not you should use it. I still believe it is a good practice to seperate design from code and I like to have that visual control of the design. IB seperates but also hides implementation behind the scenes and the connectors makes it easy to break something. And if you are using localized texts there is a bit more work to get xibs localized. There is no problem avoiding IB as you quickly will learn how to do everything by code. So I did not use IB, but I have not given it completly up yet.

You should consider to make your application localized. To do this you create localization folders in your project with extension .lproj. If you support norwegian and english, create two folders named no.lproj and en.lproj where you put your localized resource files for texts and so on. If the application is non localized it uses the development base language (set in property of the project). The base language also determines which language to use if none of the provided languages matches the user language setting. The user language is controlled by the language setting on the iPhone. In the distribution process to App store you are also localizing the descriptions and meta data of your application to be viewed on App store. Here I was a bit confused because Norwegian is not a supported option.

Data roaming
Not a real problem, but just be aware of it if you are developing applications that are supposed to by used in foreign countries and you need to use network resources. Users may have set data roaming setting to off because use of foreign network providers is usually very expensive. We wanted to show a message to the user that data roaming is off and because of this the application cannot be used properly. Is it possible to detect data roaming state with the iPhone SDK? I did find a way to check it, but the application is not allowed to set the state.

<code>- (void)checkNetworkConnection
	NSURL *theURL = [ NSURL  URLWithString: @"http://www.google.com" ];
	NSURLRequest *request = [ NSURLRequest requestWithURL:  theURL
				cachePoliy: NSURLRequestReloadIgnoringCacheData
					timeoutInterval: 65536.0
	[ NSURLConnection connectionWithRequest: request delegate: self ];

- (void)connection:(NSURLConnection *)connection didFailWithError:
(NSError *)error
	if ([error code] == -1018){ //NSURLErrorInternationalRoamingOff
	   // do something
        } else { // other network errors

Launching Other Apps within an iPhone Application
Launch other apps with NSURL. Here is an overview of codes to use. We wanted to call a number from our application which will close our application and bring up the phone. When the call has ended we want to return to our application. This is possible when opening the url with [UIApplication sharedApplication].

<code>NSString *telephoneURLString = [NSString stringWithFormat:@"telprompt:%@",
[self getPhoneNumber]]; // tel:
NSURL *telephoneURL = [[NSURL alloc] initWithString:telephoneURLString];
[[UIApplication sharedApplication] openURL:telephoneURL];
[telephoneURL release];

Before distributing to App store we needed to share the application with testers and the customer. To do that we used Ad Hd distribution which allows you to share your application with up to 100 iPhones, and to distribute your application through email or by posting it to a web site or server. To prepare the application it needs to be compiled with a distribution certificate and provision file and each iPhone needs to be registered with the UDID identifier. These steps is well documented by Apple.

To distribute to app store you first create a app store certificate and distribution profile and then build your app with it. In your build settings specify which iPhone OS version you are supporting.  Set Base SDK to the version you are building the app with and deployment target to the lowest version number you are supporting. To find your app file go to products folder in xcode and reveal in finder. Package the app file/folder into a zip file. Be aware that no spaces are allowed in the zip file name.  To upload the binary log into Itunes connect or use the application loader.

If your app requires specific hardware to run, or you only want to target iphone and not ipod touch, you can set this in the info.plist file of the application. This is important, if you don’t specify any requirements your app will be tested on both iPhone and ipod touch by Apple.


The first weeks I was completely lost and almost wanted to give up, but now after 2 months it feels almost natural to write Objective C. First time you are doing an iPhone project it is a lot to learn: how to set up you project and certificates, learning a new programming language and SDK and then in the end understand the distribution process. Apple has documented well but there are lot of material to go through. So in your first project: calculate extra time!

I really got my eyes up for mobile development, it’s an exciting platform to work with where changes happens quickly. I would love to do more mobile development for sure. But still I want to be a .NET developer ;)

February 25 / 2010
Author Jill
Category iPhone
Comments No Comments


I have been thinking about this for a while now: I really need to update my blog!
2010 – a new year, lots of new possibilities and exciting technology to learn and play with.
I have been really busy lately at work, the last month I have been learning iPhone development while developing an iPhone application. It means working in a complete new environment and platform, learning Objective C, working on a Mac. Lots of fun, and some challenges ;) So this is a jump in a new direction. Last year I have worked most of the time as part of a distributed scrum team across different countries, developing a completely new intranet solution on the Sharepoint platform – for 17 000 users! I have also done some prototyping projects, working with asp.net, Silverlight and FAST search. And some work related to Flash and Flex as well. We have recently got a Microsoft Surface table in our office, unfortunately this year has been to busy due to the iPhone project that I have not had time to play with it yet.. :)

But 2010 is also going to be a good year, because of the next versions of SharePoint and Visual Studio! I would love to work with those products. I’m going to a seminar on monday and looking forward to hear Sahil Malik talk about SP 2010!

2010 also means.. I will update my blog more often? More to come..

January 29 / 2010
Author Jill
Comments No Comments

Javscript cross domain security problem

I have a page with a popup containing a div with an iframe with a page inside. From this page inside the iframe  I have a button that I just want to call a closing popup script on the parent window. But I get a pemission denied error. What I didn’t think of, was that the parent window and the iframe page is located on different sub domains of the domain, but still on the same server. So this operation is not allowed beacuse of cross-domain security restriction of javascript. This is reasonable behaviour because we don’t want anyone outside our domain that we don’t trust to access our scripts.  But in this case we want the two sub domains to communicate: sub2.mydomain.com want to call a script on sub1.mydomain.com.  So a solution to this was adding this script to the masterpage and the page inside the iframe:

&lt;script type="text/javascript"&gt;

But be aware of this: you have to set the security domain on all pages on both domains! For a page on sub1.mydomain.com the default domain is
sub1.mydomain.com, and it has not automatically access to mydomain.com.

October 01 / 2009
Author Jill
Category Web
Comments No Comments

Web development with Aptana

I have been working a lot with html, css and javascript lately and I was looking for a good IDE for web development, and I found Aptana Studio. Its a stanadalone program but since it’s based on Eclipse so you can also plug it into Eclipse or other Eclipse-based IDEs, and it is free and opensource. It has JavaScript code completion and debugging, HTML/CSS/JavaScript code assist, and added in support for all the leading Ajax libraries (Adobe Spry, Prototype, MochiKit, YUI, Mootools, Dojo Toolkit, JQuery, Scriptaculous) as well as a JSON (JavaScript Object Notation) Editor. You can also use a number of Aptana plugins which offer tools for developing with Ruby on Rails, PHP, Adobe AIR, and Apple iPhone. There is also a pro version form $99 that adds even more features to it.

So often when working with javascript you got those ugly script errors in the browsers, but now you can get real error messages that actually tells you what’s wrong, and you have the possibility to add breakpoints and trace the scripts when running in debugging mode, that’s nice! There are also nice samples included in Aptana Studio where you can test out examples with different Ajax libraries and so on. Also I have tested Iphone development with Aptana, and it works great! It is almost to easy to set up an Iphone web application, you just create a new Iphone project, and the framework is set up ready to start developing with the basic files in place. And you can run it in debugging mode in the emulator or directly on your Iphone using the built in internal server, and immediately you get a preview of your application. There are many more IDEs for web development out there, both opensource and paid for, but I have found something I like so I’m happy developing. And this application is not only for Windows but also for Mac and Linux.

August 10 / 2009
Author Jill
Category Web
Comments No Comments
Tags , ,

New certification – MOSS configuring

mctsrgb_530I earned another certification after passing exam 70-630 Micosoft SharePoint Office Server 2007, configuring.

March 31 / 2009
Author Jill
Category Sharepoint
Comments No Comments

New design!

What to do on a Saturday when it is snowing.. and snowing, and you don’t want to go outside your door? Well I like to stay inside and puzzle with my blog :) I found this free template on Smashing Magazine which I fell in love with, and with some customizing it feels like mine.

February 23 / 2009
Author Jill
Category Myself
Comments 2 Comments

New certification!

mctsrgb_529It has been a busy week.  On monday I got a certification – I passed the 70-361 WSS 3.0, configuring MCTS exam! I was a bit unsure on some questions, and it seems that it would have been nice if I had a bit more general knowledge and experience about networking infrastructure, security and administration stuff. The exam had 41 multiple choice questeions, and I think I spent  almost 2 hours on it, I like to review my answers several times before submitting. The next exam coming up is MOSS configuring exam 70-630, can’t stop now :) I really like the focus that Tieto has on competence building, they support and encourage their employees on it.

February 21 / 2009
Author Jill
Category Sharepoint
Comments No Comments

Sharepoint Front End Developer – 1

As a Sharepoint Front End Developer I work  on a .NET / Sharepoint  platform that also includes technologies like CSS, HTML, Javascript, Flash, Flex and Silverlight. It is so exciting but also challenging.  Going from almost only be working with Flash – is like going into the real world again, a world which I almost had forgot.. Here is some of my challenges, starting with:


I thought my skills was ok, but if someone thinks CSS is easy, they are wrong!  If you want to make pixel-perfect design and get it to look nice in every browser.. you have to work hard, and even so it is maybe not possible. For my next project I want to make better and cleaner CSS from the start. I’ll start by making “dummy” html and css for the design, and start the real implementation later AFTER testing is ok.  I can’t understand why someone still uses an old browser like IE6,  but  still there are almost 20% using it –  and so you should support it. Each time you run into the same problems and hack fixes and work arounds. Looking  at CSS frameworks and patterns could be a good idea to make life easier. But even if you done all the things right from the start, then the next step is intergration into sharepoint. My experiences so far:

  • Make clean HTML and CSS  (no inline styles!). If your css becomes messy.. use a css formatter and optimizer. And take a look at 50+ CSS Best Practices and Coding Guidelines
  • Check out CSS frameworks and patterns- to get ideas – or develop your own default-styles framework.
    Blueprint CSS
  • HTML DOCTYPE – check if the doctype is specified in the production environment, so you don’t need to do changes later because it will affect the rendering of the webpage
    Doctypes and Sharepoint
  • Must haves:  inline browser developer tools like IE Developer toolbar or FireBug for Firefox
  • Check the browser statistics – and start with testing on the most “difficult” browser (like IE6). Browser tester for IE – IETester
  • In Sharepoint: do not remove the default css files (may get you into updating trouble..), if you need to change something override styles or make your own, and put everything into new files
  • Default Sharepoint layout is mostly table-based HTML that makes up a lot of code with tables inside tables, and it’s not easy to make changes to the layout, without breaking the code. So if you are able to: use DIV instead!
  • Specifing IDs on DIVs is not always good idea – because .NET / Sharepoint may add its own IDs to it when implemented
  • I’m coding  CSS in SharePoint Designer 2007
  • Lots of CSS resources: http://www.smashingmagazine.com/category/css/
January 28 / 2009
Author Jill
Category Sharepoint, Web
Comments No Comments

A new year!

Not so new anymore.. and my promise for this year is to write posts more often! I’ll try to make a post once a week.. And maybe I should post even if I feel I don’t have anything useful to say.   I have lots of  thougts about what this new year should contain, when it comes to being geeky :-D There are so much to learn and to explore, and sometimes I don’t know where to start. But as someone said.. do not worry about all the things you can’t, it will come to you eventually, if you want it to. That is my wisdom word for today :) I think I’ll try to make a list  of want I want to be geeky with, and make some prioritizing, like a backlog for myself (to use a terminology used in Scrum which I practice each day in Tieto). So here it is, just a quick draft:

1. Priority – doing it now –  things I really enjoy and care about
  • Read and prepare for exam 70-631 WSS configuring
  • Integration of silverlight / flash into a Sharepoint application – make some cool sharepoint webparts!
  • Play with JQuery
  • Best practices in CSS  – make cleaner and better css and html
  • Make a IPhone web application (working on it right now!)
  • Go to Flex Camp Norway :)
2. Priority –  do it soon – things I have interests in
  • Learn Silverlight – be able to implement a small application with design (using Expression Blend)
  • Look at design patterns
  • Flash CS4 / Flex- play more with 3D (papervision, Away3D) and real-time, multi-user applications
  • Check out interesting videos on tv.adobe.com
  • Look at open source frameworks and projects
  • Study for .NET / Sharepoint  certifications – and become a better .NET developer
3. Priority – do it later – things I want to look at but don’t know yet if I care
  • Domain Driven Design (DDD) and Test Driven Development (TDD)
  • LINQ
  • Unit testing
  • Play with Adobe Cocomo
January 25 / 2009
Author Jill
Category Myself
Comments No Comments

What is SharePoint?

I have been working with SharePoint for a couple of months now and still learning. Recently I attended this 5-day course: Advanced SharePoint 2007 Development, quite a good course if you are a totally beginner, it covers lot of stuff both through customization and code samples, but not everything being useful in my way of view. I ‘ve would have like to learned more about the development processes and best practices for development in SharePoint, and also more on user interface customization (masterpages) and examples of integrating with Silverlight/Flash/AJAX.

Quite often I’ve tried to explain to people what I’m working with, referring to Microsoft Office SharePoint Server 2007 (MOSS) which is among one the best selling products from Microsoft. But SharePoint also refers to Windows SharePoint Services (WSS), and it’s important to know the difference between the two. Read more →

November 03 / 2008
Author Jill
Category Sharepoint
Comments No Comments