Basic Integration of Firebase Remote Config into an iOS App

I recently attended iOSDEVUK in Aberystwyth. There was a fascinating talk by Todd Kerpleman (@toddkerpleman) about using Firebase to perform A/B testing.

The technology is pretty cool so I created a demo project. If you’re looking to integrate Firebase into your app then this tutorial looks specifically at how to integrate Firebase Remote Config into your app.

  1. Start by creating a brand new app in xCode. Make sure its set up within a workspace and that you have CocoaPods installed and setup.
  2. Add pod ‘Firebase/RemoteConfig’ to your pods file and run pod install
  3. Make a note of your apps bundle identifier.
  4. Go to http://firebase.google.com and sign up for an account.
  5. Select Create New Project, give your project a name and select your region.screen-shot-2016-09-07-at-14-10-57
  6. Once in the project select the option to Add Firebase to your iOS App.
    screen-shot-2016-09-07-at-14-12-42
  7. Enter your apps bundle identifier and if the app is going to production also enter the app store identifier for your app.
  8. The file GoogleService-Info.plist will be downloaded to your computer.
  9. Drag this file into your xCode projectYou’re now ready to start interacting with Firebase from within iOS.For the purposes of this tutorial I am going to create an app that downloads Constants from Firebase and changes the appearance of a button within my app based upon the retrieved values.
  1. Modify your apps storyboard and add a simple UIButton. Connect the UIButton to your class file as an IBOutlet.We now need to set the app up to download our constants values from Firebase. I’ve decided that I would like the app to download values from Firebase on each launch.
  1. Add a plist to your app and name it plist
  1. Add a new CocoaTouch class to xCode with a subclass of NSObject. Name the file Constants.swift
  1. At the top of the class add the line of code import Firebase
  1. Create a new mutable variable remoteConfig with a type of FIRRemoteConfig

 var remoteConfig:FirRemoteConfig!

  1. Add a new function to the class and call it createDefaults. This function is going to create an instance of the default firebase values and make them accessible by your app.
    screen-shot-2016-09-07-at-14-31-38
  2. Add a new function called setupApp. This function will retrieve the RemoteConfig from Firebase. This function will call createDefaults() to instantiate the default Firebase values.screen-shot-2016-09-07-at-14-33-15The statement self.remoteConfig.activateFetched() instructs your app to replace the local defaults with those fetched from the server.
  1. In the AppDelegate.swift file import Firebase
  1. In the AppDelegate.swift file call FIRApp.configure() from within didFinishLaunchingWithOptions
  1. In the AppDelegate.swift file call Constants().setupAPP() from within didFinishLaunchingWithOptions
  1. If you build and run your app you should now see a log in the console that reads “Config Fetched”
  1. You now need to retrieve key values from the default data returned from Firebase. In Constants.swift create a new function called getButtonText() which returns a string value.screen-shot-2016-09-07-at-14-40-15
  1. In Firebase create a new RemoteConfig property called “ButtonText”. In the example below I’ve also created properties for ButtonTextColor and ButtonColor.screen-shot-2016-09-07-at-14-43-14
  1. Calling Constants().getButtonText from the view controller will then return the value to be used as the label for the Button.screen-shot-2016-09-07-at-14-48-10
  1. You can now create properties in Firebase for any setting within your app easily retrieve it and use it anywhere within your app.

The sample project for this app is available on Github https://github.com/stephenwestgarth/FirebaseRemoteConfigSampleApp/

You will need to replace the GoogleService-Info.plist with your own created in Firebase if you want to see anything other than the values that I have created.

 

Advertisements
Categories: Apple, Google, Tutorial | Leave a comment

iOSDEVUK Review 2016

IOSDEVUK is over for another year; our annual pilgrimage to Aberystwyth always end in a sad train journey home – all the better for the knowledge we’ve gained throughout the week.

As is tradition, here is my round up of the week and my very best bits!

Running A/B tests on your app using Firebase Remote Config and Analytics

Todd Kerpelman

Prior to iOSDEVUK I hadn’t come across Firebase. This tool is phenomenal and can do brilliant things that allow you to control detailed configuration of your app without the need to submit your app for an apple review. Watch out for a blog post tutorial soon showing how you can set it up in a basic project.
Todd was a brilliant speaker, very engaging. One of my favorite talks by far!

Diagnosing Allergies

Emily Toop

This was quite simply interesting. Emily sneezes a lot and is using iOS to track her sneezes in order to help work out what’s causing it. It’s a real world use case for how mobile technology can be used to collect high volumes of data, analyze it and then make use of it in the real world. If you get chance to listen to Emily talk about her sneezing I would highly recommend it.

I’m an Idiot

Richard Turton

Sometimes as developers it does us good to remember that we are all human, we all make mistakes, miss the blindingly obvious and ultimately we are all idiots …. Sometimes.
This talk reminded me that if we need help, we should ask for it and if we share knowledge the community is stronger for it. My take away message from the talk though was that under no circumstances should you ever try to be CLEVER! It always backfires.

img_5097-2

Steve Scott

Steve Scott

Scotty is a brilliant speaker! He has a habit of stating the blindingly obvious in a hilarious way. Scotty reviewed where we have come from as developers and where we are going to; the underlying tone of the talk was the fact that while iOS is a very rich place today for developers this is unlikely to remain the case forever. This changing landscape is part of evolution and even visionary entrepreneurs can’t predict the future! He also emphasised that sometimes people do get it right – can you believe that less than 40 years ago it was considered ambitious to have a computer on every desk, in every work place and in every home!
img_5090

Review of the Year

Dave Verwer

No-one knows the world of iOS like Dave Verwer, writing iOSDEVWEEKLY really does give him an insight into our world like no-other. The stats Dave is able to create showing who is reading iOSDEVWEEKLY are a portal onto the iOS Development Community that just blows you away. Brilliant speaker and in my view Dave is one of the cornerstones that makes doing what we do so interesting.

Dyson Hackathon

img_5100 img_5099

This totally blew me away! I’ve been to hackathons before and they are always brilliant fun but then Dyson entered the room with 16 robotic vacuum cleaners! Words cannot describe how good this event was – I still say we were cheated as our balloon burst itself in the final battle, the stewards’ enquiry is still open in my eyes; but I’m not bitter.
Serious kudos though for a job thoroughly well done.

Conferences are an essential part of our learning as developers and have a huge impact on companies. I want to say a massive thank you to Chris, Neil, John and the team here in Aber; once again you have raised the bar and delivered a brilliant event!

So that’s it; iOSDEVUK is over for another year. If you can’t wait a whole year for another conference check out what we are doing in Chester 17th – 20th April 2017. CodeMobile is a brand new developer conference focusing on both Android and iOS Development. We need more events of this type in the community because when you bring developers together it really does create magic!

Categories: Apple, Conferences, Invention, Robots, Social, Technology | Leave a comment

What’s next for the iPhone?

I can’t believe its almost time for Apple’s September event! It seems like only 5 minutes since apple released the iPhone 6s and 6s Plus and yet here we are anticipating the release of the iPhone 7.

I always find following predictions about what Apple are going to do very interesting. The issue is that over the years it has become increasingly hard for Apple to wow me because much of my tech wish list is now complete. In the early 2000’s when I was still in school I used to dream about a phone that could connect to the internet, that would allow me to record video, share photos and listen to my music. I remember being delighted when I got a pocket PC but in reality being really let down by what the device actually did.

All of those troubles are long behind us. So now I ask what else do we want from Apple and more specifically from the iPhone? What is my new wish list? Here are some ideas:

Wireless Charging

This has been tried by a number of companies but its still not quite here. The idea of simply being able to put my phone onto a surface (ideally any surface) and have it charge is a brilliant concept although I accept that it comes with a lot of challenges. This is definitely something I would like to see brought to market with apples usual flair of simplicity and elegance.

Battery Life

Over the years battery life has improved dramatically however the power demands of devices have also increased significantly. I really want a battery that lasts. When I say lasts I want a battery that can take 12 hours hard use and still not give up – I hate having to carry around my charger.

In the absence of a brilliant battery that never dies what about exploring ideas to extend the battery life. I would love to see a solar powered phone that charges from the sunlight.

Dual Sim

This can be done already but its expensive. I really want the ability for my phone to have 2 telephone numbers, 1 for work and 1 for home. It would be great if I could select which SIM I want to use for certain numbers and then also allow incoming calls on the SIMS to be denied based upon a schedule.

Personal Assistant

Siri is brilliant but I still think there is a lot could be done in terms of improving Siri’s artificial intelligence. Is it plausible that one day we could have a conversation with Siri and that the system would answer in an almost human like fashion?

Ubiquitous Internet Connections

This isn’t in Apples control but its important to draw attention to it. I’m writing this while sat on a train on my way to iOSDEVUK. I havn’t had a mobile signal since Shrewsbury. Large towns and cities have now got 4g and that’s great but what I really want to see is 4g everywhere. Some would argue this isn’t worth the investment especially in rural Britain but when you realize what the internet can do for small communities I think its not only worth the investment but is actually an essential investment.

Life Interaction

The iPhone is now an extension of me it therefore makes sense that my iPhone should interact with the world around me. With iBeacons and location services my iPhone is now very aware of where it is but I would like my iPhone to be more intelligent. For example when in any restaurant wouldn’t it be awesome to be able to see the menu on your phone; to be able to call the waitress and even ask for your bill and pay without having to attract someone’s attention? When queuing at Alton Towers wouldn’t it be awesome if you could see an estimated length of time you were going to be waiting; or even avoid the queue to buy tickets altogether by being prompted to do so as soon as you arrive.

Linked to this is the idea of my iPhone being able to do everyday tasks. Homekit has introduced great new features in terms of being able to control my house; heating, lighting etc. I would love to see this expanded and a much greater rate of adoption – why do I need to carry keys for example; surely I should be able to unlock my house and car without a key? Also as soon as I leave home my phone should prompt me to turn on the intruder alarm.

The other thing that would really help us as developers to achieve this is if Apple were to open up the NFC chip so that we can develop applications that use it.

Apple Watch

Quite simply this needs to fully function without a phone. This is beyond running native apps; I want to see full WIFI, 4g connectivity and have the ability to use all features when my iPhone isn’t close by.

 

I’m sure I want and need more from my iPhone and there are a lot of things I could add to this wish list but I’m very aware that Apple Engineers are busy people. If its possible to just achieve the above this year, the rest of my wish list can wait until 2017 J

 

 

Categories: Apple, Technology | Leave a comment

Your Problems are NOT your Users Problems

How many times have you been faced with this:

Picture1

I complete captchas on a daily basis and am faced with them wherever I go on the internet. What does the captcha represent to you?

To me as a developer it’s a way that developers use to reduce the amount of spam that is received as a result of automated bots that roam the internet exploiting weaknesses. To me as a user it is a burden on humanity that gets in the way of me achieving my aims and objectives of using the web.

The issue I have with this overused annoyance is that it does not solve any problem that I as a user have! Instead it solves problems that I face as a developer! The real issue here and my big revelation is that:

YOUR PROBLEMS ARE NOT YOUR USERS PROBLEMS

Just stop for a second and read that again! Your problems are NOT your users problems.

If we forget the problem that the captcha solves and focus on our users, captchas are a horrific creation. They interrupt the users flow, get in the way of what the user wants to do but worse that they the humble captcha annoys the user especially when they are so complicated its impossible to work out what the system wants you to type or click. Whoever thought that a captcha was a good idea in my view should be taken immediately and put into room 101.

So what are the alternatives? It would be wrong of me to sit here berate you as a for using a captcha without offering some alternatives.

The real issue is that as developers we need to verify that the person who is using our system is real; I believe a captcha is a lazy way of doing this.

Take this scenario! You have a contact form that you are expecting a user to complete; you are worried that unless you use a captcha you will receive huge volumes of spam because there is nothing to prevent a bot from submitting the form.

In reality it is going to take a few second for the user to complete each of the fields – if there is a long message box it might take even longer still.

Computerised bots don’t hang around when completing forms; they get to the form and they repeatedly spam it submitting it multiple times a second.

A potential solution here is to track the behavior of users on our pages. If we record how long it takes the user to complete the form, we can come up with a pretty good idea of whether our user is a real human.

If we get suspicious that the user isn’t real because the form was completed to quickly then maybe this is the point that its ok to use a captcha. But for 95% of users visiting our site its ok just to let the submission through because their behavior verified that they are real.

Of course the above scenario and solution throws up problems. Is it ok for us to track what our users are doing on our websites; will our users be happy with this? My view is that we need to educate users; make the reasons for this clear within the privacy policy so they can read about it – you could even tell them that the alternative is to have a captcha before every submission and I’m sure most users will sympathize and understand.

The work being done by the guys at NUCAPTCHA explores all of these ideas and is revolutionising the way that Captcha works.

Another interesting way to beat the captcha and improve our users experience is to gamify the experience. If we are going to make the user do something tedious what’s wrong with making it a more enjoyable experience; everyone enjoys playing games. That’s exactly the approach that is being taken by SweetCaptcha as they try to make captchas fun.

I’m not naïve enough to think that the captcha is going to go away anytime soon but I hope that this post will make you stop and think about whether there is a way you can solve your problems in a better way that improves your users experience; or at least makes your user smile to brighten their day.

Of course this is only one very small example of how developers inconvenience users to solve their problems. Next time you are faced with a scenario where you need to solve a problem consider what impact your solution will have on the end user and then ask yourself if your solution is a legitimate burden to a user or whether it to should be resigned to room 101.

Categories: Design, UX | Leave a comment

Brilliant UX

I’ve recently found myself talking to people more and more about what makes UX either really really good or really really bad.

I came across this image online which I think sums up best practice of user interface design.

CqKlrrHXYAAZLfQ.jpg-large

Its important to look at how this manifests itself in real life. The best example of exceptional user interface design that comes into every day life is the common Door Handle.

doorhandleThe door handle is a brilliant example of user interface design because it is quite simply one of the most intuitive objects of everyday life.

I don’t ever remember being told how to use a door handle; and its a concept that in thousands of videos online you see conquered by children and animals alike with absolutely no direction.

This is so true that in nursery schools often the door handle is moved so it is out of reach of the children because staff know if the children can reach the handle then they will be able to open it.

The door handle is quite simply an elegant solution to a complex problem. It hasn’t been over engineered and actually goes unnoticed for the vast majority of the time. Yet imagine the issues we would have if the humble door handle didn’t exist? We would struggle to open doors, wouldn’t be able to lock doors and secure our property, car boots and cars more generally would face difficulties; and if expand the concept to cover the generic handle how many every every day objects would be effected.

Compare and contrast this to UI on the web. We regularly see examples of good clean UI, simplistic in its nature, not over engineered and easy for our users to understand. One of the best examples of stunning UI on the web can be seen on the gov.uk website.
Screen Shot 2016-08-28 at 19.45.46
This website learns from the simplicity of the door handle by making it very obvious what to do. A user has w very clear options when they visit the home page, search or click on a relevant link. When you consider the volume of information published on this website it really is a triumph that it has been categorised into 16 clearly defined areas.

Now lets consider the navigation on this website

Screen Shot 2016-08-28 at 19.56.55

I acknowledge that I have selected an extreme example; but in the website above the navigation is confusing, over engineered and doesn’t help the user to find the content that they are looking for.

The creators of the website above have worked on the principle that everything on the website should be accessible within 2 clicks. While this is a good principle in theory there are times when the rules doesn’t work and simply isn’t helpful to our users. As designs as we search to optimise or users experience by reducing the number of clicks we often find ourselves giving users a greater number of choices which only serves to confuse our users.

The moral of the story here is that we should all try to make our websites more like Door Handles; emulate the simpicity and improve our users flow as they access our online content.

Categories: Design, Technology, UX | Leave a comment

Developer Conferences

If you’re anything like me then you will love a good developer conference! The opportunity to share and collaborate with like minded people is sometimes just what the doctor ordered to help make sure those creative juices are flowing.

Unfortunately, in the UK we seem to have a lack of events; especially outside of London. There are a couple of independent events like iOSDEVUK and a few others organised by the tech giants such as Microsoft and Google. The issue is that the vast majority of events tend to happen in the south, in and around London and often us up here in the North feel a bit left out.

I’ve recently been chatting about this phenomena to some of my developer friends and colleagues; and the conclusion we have come to is that if there are no conferences happening locally to help promote knowledge share and collaboration between developers, then the only solution is to set one up ourselves!

We got chatting with some friends; those friends made some introductions and the result is CodeMobile – a conference specifically created for Mobile Developers. The event will take place just after easter next year (18th, 19th and 20th April), is a 3 night residential and has 2 tracks, one for Android Developers and another for iOS Developers.

In creating the conference we’ve deliberately tried to make it as accessible as possible for developers from all backgrounds. The ticket price is as cheap as it possibly can be (Super Early Bird, £275 & £350 Full Price) which will hopefully allow Indie Developers who are not backed by big corporations to come along; and we’ve been fortunate enough to attract a plethora of speakers from both the UK and internationally.

Putting the conference together over the past few weeks has been an absolute whirlwind of an experience and I’m delighted we’ve had so much support and encouragement from within the developer community. We are now in the process of finalising the speakers list (there are still some great speakers to add to the list) and also confirm details before tickets go on sale on 1st September 2016.

As this is a new conference any help and support you can give will be very much appreciated. In particular we need help reaching out to developer networks and communities to make sure everyone is aware of the event. If you’re involved in a local meet-up or know any developers who might be interested a tweet mentioning the conference website or that tags those who might be interested would be hugely appreciated.

We’ve also opened up the possibility of winning some free conference tickets! If you want to be in with a chance then you just need to get your tweet on on follow the instructions on the Free Tickets page of the conference website.

I would love to hear any feedback about the event that you might have! Also if you have any speakers you would like to see at the event please drop me a line – I can’t promise but we will certainly reach out to those speakers and see if its possible to get them to attend.

My dream for this conference is that the developer community take ownership of it and that it becomes a true community event; to that end if you have any ideas or suggestions please drop me a tweet.

Once tickets go on sale please show your support by signing up to attend if you’re interested and able. It would be brilliant to see you at the event! You can also follow @codemobileuk on twitter, and find all related information on the conference website www.codemobile.co.uk

Categories: Android, Apple, Apps, Conferences, Social, Technology | Leave a comment

A Social Review of 2015

So in a follow up to my social review of 2014 I thought it worthwhile to continue to trend and take a look back at 2015 and highlight what has been making the news particularly in the world of Apple. There have been some big technological changes and advancements in 2015 but I think the big thing that is holding us back is mass adoption.

1. Apple Watch Arrived

It seems like a long time ago now but the Apple Watch was finally released to the public. The watch had been rumoured as far back as 2011; and when it was announced in September 2014 it lived up to the hype but we still couldn’t get our hands on it! It wasn’t until April 2015 that I finally got my hands on one but many had to wait several months while Apple processed the back orders.

It still hasn’t changed the world though – it is now the best selling smart watch on the market but it hasn’t received mass adoption. I am still one of only 5 people that I know who has one which even in terms of my friendship circle is a very small percentage. 

The watch is brilliant though; it’s the first smart watch that I have religiously worn on a daily basis. That said I’m probably not alone in that I use a very small fraction of the features. I love that Micky Mouse tells me the time, and it’s very useful to see when my next meeting is. The Taptic feedback on google maps has come in handy on a couple of occasions and the ability to read text messages without getting my phone out of my pocket is helpful. Sending my heartbeat to the other 4 people that I know with a watch was fun for 5 minutes, and the ability to send drawings amused me for a few hours but in reality these gimmicks while good for show stopping media launches have little value to the long term use of the product.

The big question is whether it’s prohibitive price tag will ever allow it to become mass market? I hope that it does but I fear if there isn’t a drastic increase in adoption during 2016 it may simply become an apple fringe product at best.

2. New Apple TV

Again this was very overdue, rumoured and promised for years but finally this year we got our hands on the new Apple TV. Apple very kindly gave Apple Developers a new box for free and it hasn’t disappointed. It seems the uptake is healthy and the feedback seems generally positive. The TVOS App Store still has a very small number of apps but I guess this is to be expected. 2016 will see an explosion of apps and I’m optimistic that the future of Apple TV will see it challenge the games console market.

3. IPad Pro

Sticking with the Apple Trend Apple launched the iPad Pro. To say I’m septical about the need for a bigger iPad would be a huge understatement; that said I’m writing this article on one and it has to be said I find it much more comfortable to use that either the iPad Air or the iPad Mini. My issue with it is that it is largely a laptop replacement and that’s how I’m using it! It feels to me like it needs to have a greater range of software abilities and iOS is a little limiting on the device. That said I don’t subscribe to the need to have a full version of OSX on the device and I’m not sure that would work well. Maybe iOS needs to morph into iOSPro or similar? And it’s definitely time that Apple dealt with the issue of file management within their flagship mobile operating system.

There have been other steps forward, Apple Music launched with great hype; as expected we got a new iPhone (6s and 6s Plus) the next generation of OSX also has some nice enhancements. I still have the feeling that Apple are riding the crest of a wave though – they are still the most profitable company in the world but somehow in the mix of all of these new products I still continue to want more from them. I don’t know what I want but whatever it is I feel it needs to do what iPhone did back in 2007 and change the world!

Categories: Uncategorized | Leave a comment

HTML Elements

It seems to me that everyone can build a website! Some people build websites better than others; many use outdated technologies or haven’t stayed up to speed with web standards and the latest developments within HTML5 jQuery and the like – but none the less building websites and adding content to the web is easier than ever.

I recently came across this periodic table of valid HTML elements. So if you’re building websites; aren’t sure if the tag you are using is allowed; or just want to explore your knowledge of HTML markup take a look! You never know you might just find a tag that you didn’t know existed and it might solve a problem that has been bugging you for months. Enjoy!
  
If you want more information on any of the elements check out W3C.

Categories: Uncategorized | Leave a comment

Create a free website or blog at WordPress.com.