Monthly Archives: September 2016

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

Blog at WordPress.com.