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, check it out!
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 accuracy
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
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.
Localization
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.
- (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].
NSString *telephoneURLString = [NSString stringWithFormat:@"telprompt:%@",
[self getPhoneNumber]]; // tel:
NSURL *telephoneURL = [[NSURL alloc] initWithString:telephoneURLString];
[[UIApplication sharedApplication] openURL:telephoneURL];
[telephoneURL release];
Distribution
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.
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
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..
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:
<script type="text/javascript"> document.domain="mydomain.com"; </script>
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.
Her er noen av mine hobbyprosjekter som inneholder verken data eller programmering! Jeg har akkurat lært meg å hekle bestemorruter etter og ha funnet disse videoene på på nett. Ikke så vanskelig i det hele tatt, men håper produksjonen går litt fortere etterhvert. Tviler kanskje på at det blir et teppe.. er vel litt mye jobb. Men artig å holde på med. Jeg har også noen syprosjekter på gang, og er helt frelst etter stoff og stæsj, for eksempel fra denne nettsida: Etsy, en slags ebay for håndarbeid. Mye fint! Og ellers syns jeg det er gøy med interiør og av og til tar kreativiteten overhånd
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.
Kvænangen kommune ligger i nord-troms og grenser til finmark. På et areal på 2117 km2 bor det ca 1300 mennesker. Navnet Kvænangen kommer av kvæner (kvener) som er norsk for «finsktalende folk», og angr som er norrønt for «fjord». Naturen her er variert og landskapet strekker seg fra finmarksvidda i øst ut til kysten med holmer og skjær. Kvænangen er rik på kulturminner fra eldre og nyere tid, og det er funnet flere bo- og gravplasser. De første spor etter mennesker stammer fra eldre steinalder om lag 10.000 år tilbake. Fra vikingtid og middelalder finnes en rekke sjøsamiske kulturminner. Kulturen i Kvænangen gjenspeiler møtet mellom de ulike etniske befolkningsgrupper: Den sjøsamiske Siida-samfunnet bestod av et mindre antall kjernefamilier som hadde felles bruksrett til naturressursene i området. Senere ble fangst og fiske kombinert med husdyrhold, og etter hvert økte det kommersielt fisket. Den norske bosetningen var forholdsvis liten og basert på fiskeeksport og annen handelsvirksomhet Reindriftssamene fra Kautokeino har siden 1600-tallet benyttet Kvænangen som sommerbeiteland På 1700-tallet bosatte de første kvenene seg i indre Kvænangen, og livnærte seg av jordbruk, skogbruk og fiske.
Slik fikk Kvænangen tre folkeslag, samer, nordmenn og kvener. Men som følge av den harde fornorskningen og moderniseringen etter krigen ble de kulturelle forskjellene etter hvert utvisket. Sett utenfra framstår dermed Kvænangen i dag som et temmelig homogent samfunn.
I earned another certification after passing exam 70-630 Micosoft SharePoint Office Server 2007, configuring.
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.
It 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.