posted by robert | filed under uncategorized
Should anybody wish to leave a comment for any of my previous posts – despite the fact that I haven’t written a post or answered a comment in months (over a year, in fact) – then please be aware that it won’t work.
After having been rather surprised by a huge leap in comments traffic, none of which ACTUALLY came through as comments, and a jump in referrals from some very dubious-looking domains, I have disabled commenting on this blog.
As far as the future of the blog itself is concerned, I have not yet decided whether to start writing regularly again or not. The blog will stay online for now and all existing content will continue to be available until I reach a decision.
Anybody wishing to contact me can do so via my Facebook page (link in the navigation to the right) or by email (link elsewhere on this site).
Thank you for your understanding!
I’ve recently had feedback from one or two “Facebook Application Development” course students who’ve ran into the infamous “error 191″ problem when trying to run their Facebook Apps.
Normally this error is caused by using an incorrect URL in the ‘redirect_uri’ parameter for getLoginUrl when using the PHP SDK, for example:
$loginUrl = $facebook->getLoginUrl(array('scope'=> 'user_checkins','redirect_uri'=> $app_url));
Another potential cause of this error is mixing your http: and https: URLs or assigning a http: URL to this parameter when the user is actually using a secure https: URL to access your App.
When I recorded the Facebook course the need to check the protocol and assign the correct http: or https: URL simply wasn’t there. Now we need to do this. Many users have switched over to using Facebook over a secure connection and Facebook will also switch off support for http:-only Apps anytime soon (as usual, no exact date).
Here’s a little snippet you can use to check for the protocol being used and assign the ‘redirect_uri’ correctly:
$protocol = ($_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
Then simply prepend $protocol to your ‘apps.facebook.com/…’ string to form the URL.
If that’s not the issue and all seems to be fine, all URLs look right and you simply can’t see what else could be wrong, then don’t panic: Stop pulling your hair out
Have you set up an App Namespace in the Developer App?
It turns out that, if you don’t set this and use the APP NAMESPACE to refer to the App, you can get the dreaded 191 error. Set it and use it in your redirect_uri instead of the FB-generated App ID number.
When I recorded the course, the App Namespace was generated and used by default to reference the App. Hence the problem didn’t arise. This is one of the things that have changed since the course was recorded.
- Check that your URLs and protocols match – both in the Developer App and in your code.
- Assign the correct protocol when assigning the ‘redirect_uri’ parameter for getLoginUrl().
- Use the App Namespace and not the App ID to reference your App on apps.facebook.com
There have, of course, been many more changes in the World of Facebook App Dev since I recored the course – even since it’s release. Watch this space for more updates over the next few weeks!
Happy Facebook App-building!
In addition to being available online, my video2brain iPhone and iOS 5 Advanced App Development: Learn by Video course is also available to purchase in DVD form
For those of you who haven’t seen how these physical media courses look I’ve taken a couple of photos:
The DVD is packaged rather neatly with an flap on the back of the package. Open the flap and you’ll find a window that reveals the DVD itself and also an accompanying 48-page booklet which contains extra material in addition to that covered by the course. The booklet for this course covers the top features of iOS 5 for developers and also contains a chapter full of tips and advice on testing, preparing and marketing your app – something I felt was important to include with the course.
The booklet also contains important information to help you get the most out of the course and is very nicely finished off, easy to read:
So, as you can see, owning the course on DVD brings with it the bonus of extra material in the form of the booklet – 48 pages of content designed to complement and extend the course material – all written by yours truly!
Pop over to Amazon and get yours today! The link is in the sidebar to the right!
Yes, the second iOS 5 title from my 10-day recording marathon in Graz in mid-October is now available online!
This more advanced workshop covers new opportunities open for the iOS developer following the release of iOS 5: Twitter integration, iCloud, new ways to easily customize the look of your apps, and storyboards.
It also goes through the use of Blocks and why you really need to know how to use them and covers how you can include sound effects and music library audio in your Apps.
All in all, the course covers 3 hours and 55 minutes – including one mega lesson on storyboards. This storyboard lesson can also be watched for free for a limited time from my video courses page!
To purchase the course for online on-demand viewing, follow the link from the above lesson back to the course overview page or click here…
As you can see if you look across to the right-hand sidebar of this blog, the course will also be available very soon on DVD, with an accompanying course booklet covering some extra materials to complement the course – including tips on testing and preparing your app for launch in the App Store and how to market your app. The DVD version of the course can be pre-ordered from Amazon using the link there, or by clicking here…
The thing that pleases me most about the two iOS 5 courses (see my previous blog post about the “Getting Started with iOS 5″ course) is not only that I managed to complete them while suffering from a bad cold AND you can’t notice it in my voice, BUT that I was able to record them within days of the release of iOS 5 and they are already produced and on the market within only a few weeks – great work from the video2brain and Peachpit post-production teams!
Together with the original iOS 4-based “iPhone and iOS Application Development Workshop” released earlier this year, the three courses give a comprehensive grounding for any iOS developer looking to build apps utilising a wide range of the available functionality for iPhone, iPad and co.
I’m looking forward to feedback from those of you who watch the free lessons or purchase and follow the courses – please do use the comment forms on any of the related blog posts or write directly to me under “mail” at this domain. You can also leave feedback for me on my Facebook Page if you wish!
All the best
Here it is: My recently-recorded “Getting Started with iOS 5″ video training, my third title with video2brain, is now available for purchase OR as part of your video2brain English Library Subscription!
You can find details of the course and some free sample lessons, plus the welcome video from yours truly, on my video courses page or here…
OR, find out more about the video2brain subscriptions (including a special promotional pricing) here…
I’ll no doubt be posting more iOS 5-related content here soon – watch this space…
Meanwhile, happy coding
Last week’s big news from video2brain was the launch of a new subscription model for ALL video trainings in the English-language course library!
Take a look at this short video to find out more:
The subscriptions are available in either Platinum, Gold or Standard form and give you instant, unlimited access to the English-language Video Training Library™. There are currently 132 courses available, with 5,877 video lessons, with new courses added throughout the month. A subscription lets you learn anytime you’d like and keep up to date with the latest software and techniques.
There’s also a special $12.99 per month launch promotion running for a limited time so sign up quickly to take advantage of the offer!
Have fun learning!
This week I received an exciting parcel from my friends at video2brain:
Yes – the Facebook Application Development : Learn By Video Workshop DVD and book is here! I’ve checked around a few booksellers online and it’s shipping now!!!
Amazon.co.uk appear to be currently out of stock (good news for us, but not so good for you I’m afraid) but the .com link above should find some copies still in stock at the moment. Grab one quick – they’re going fast!
The benefit of owning the DVD course, apart from the nice packaging, is that you’ll also receive a copy of the accompanying 48-page book which builds on course content to discuss in more detail the building, and integration, of Flash/Actionscript-based Facebook applications – including a chapter on building a Facebook PHP framework and AMFPHP Gateway for use in Flash-based applications by my friend and daily colleague in the world of Facebook Development, Neil Young. Thanks Neil!
The book adds a lot of value to the course if you’re going to be involved in creating interactive Flash-based Facebook applications and I’d certainly recommend buying this edition of the course!
Don’t forget – Christmas is coming!
…continuing on from the last post, I present you the final instalment of extra notes to my video2brain video training “iPhone and iOS Application Development Workshop” (see course contents): This time I’m going to cover how you can access compass data…
Obtaining Heading information from a device’s compass
If your user’s device has a compass then you’ll also be able to obtain heading data and determine the direction in which their device is pointing. This will work independent of whether or not your App has Core Location Services running and active.
If Core Location Services are active and accessible for your App (i.e. the user has granted your App permission to access their location) then you’ll receive both magnetic headings and true headings data – with the true heading having being calculated based upon the device’s location and taking magnetic declination (sometimes called magnetic variation) into account!
Without Core Location Services running for your App you’ll only receive magnetic heading data, making headings used by your App less accurate.
Adding heading information to your App is simply a matter of setting up and initialising your Location Manager to receive heading updates:
The code below shows compass support added to the myLocation App including the required delegate method, used to receive updates to heading data:
When accessing a device’s compass for the first time, a calibration display will be shown:
To remove this display from the screen after a short amount of time, allowing you to maintain the integrity of your visual design, use the CLLocationManager dismissHeadingCalibrationDisplay method.
An important thing to note when using headings data is that you MUST check for device support using the headingAvailable method of CLLocationManager. If the device does not have a compass and you start monitoring for heading-related updates, your delegate methods will receive no events at all.
Also, if your App stops running, all heading-related updates will also stop. You will then need to start receiving updates again upon restart of your App. If your App continues to run in the background, updates will be suspended and then resumed automatically once your App is awakened. This is an important difference in the treatment of heading data updates from location data updates.
Developing location-aware Apps – over to you!
You’ve now seen how to implement location-based features in your Apps and also learned more about the important issues of battery life. There are practically limitless opportunities out there for good location-aware Apps and the very nature of mobile devices such as iPhones (and iPads) makes this type of App not only a logical, but also an often very practical, choice.
The only limit to what you can do with a user’s location and heading information lies in how we choose to use it. Combined with other device capabilities, we have powerful tools at our disposal for the creation of exciting and entertaining Apps!
…continuing on from the last post, the fourth of five extra notes to my video2brain video training “iPhone and iOS Application Development Workshop” will cover accuracy and distance filters – with reference to the “myLocation” App developed as part of the course (see course contents):
As already stated in my last post in this series, this is one area where you can provide your users with a “power-saving” option or by default ensure that battery drain is lower for your App than for others.
If we take a look at the init method of our CoreLocationController Class for myLocation, we can limit the amount of updates we’ll receive and hence the reported accuracy by implementing a desired accuracy:
Using a desired accuracy of
will result in the user’s device attempting to achieve a level of accuracy to within 1 kilometer. If an even lower level of accuracy is acceptable we can choose
instead. For the highest level of accuracy possible within the limitations of the device being used, we’ll choose
All possible options for desiredAccuracy are:
– Uses the highest possible level of accuracy available, augmented by additional sensor data. This accuracy level should be used only when the device is connected to an external power supply as power drain will be high.
– The highest level of accuracy for devices running on battery power. Power drain will, however, be high and you should provide a “power-saving” option if possible.
- Accurate to within 10 meters.
– Accurate to within 100 meters.
– Accurate to within one kilometer.
– Accurate to within three kilometers.
Distance filters provide another means for reducing power consumption. A distance filter does not define the accuracy of location data but rather defines when an update will be triggered. For this reason, it makes a great deal of sense to use distance filters to limit the number of updates your App will receive.
The following code shows a distance filter defined for the init method of our CoreLocationController Class for myLocation
The result of adding this filter is that the myLocation App will report new location data updates every time the device is moved 1000m or more, to within an accuracy of 1000m, or 1 kilometer.
You can specify any distance in meters for a distance filter. The default value for distance filters is none –
With a combination of desiredAccuracy and distanceFilter, it’s possible to create a location-aware App with various power consumption schemes and levels of reported location accuracy. Giving your users the choice between high accuracy with high battery drain OR lower accuracy (but still usable) with lower battery drain may well help your App to stand out from other competitive Apps!
Note: These notes were compiled at the time of production of the “iPhone and iOS Application Development Workshop” course and there have since been some exciting updates to the Core Location API. Watch this space for some more iOS 5 updates – coming soon!
If you haven’t seen the course yet, then you have no excuse NOT to buy it now – you can currently buy it for 20% off using the Special discount code: IOSD20 = £17.59 – that’s 3 hours 45 minutes of video training (a lot of coding!) for less than a pizza and a beer! Here’s the link:
Meanwhile, the final part of these extra notes will be released in a few days’ time… Watch this space.
Still not checked out my “iPhone and iOS Application Development Workshop” video training?
Now you’ve got no excuse as I’ve organised a special 20% discount offer for all readers of my blog!
Keep reading for the special discount code…
If you’re an iOS developer and want to learn how to take advantage of ANY of the following advanced APIs or device features, then the video training is for you:
- - Core Location and Map Kit
- - AddressBook
- - Event Kit
- - Camera and Media libraries (including the Assets Library)
- - Email and Messaging
- - an introduction to Universal Apps
This 3hr 45m on-demand course was released in July this year and has been very popular – not least because the contents are still totally applicable following the release of iOS 5!
Give yourself a pre-Christmas treat and purchase the course online from my video courses link above or using the following link:
Don’t forget to enter the special discount code during checkout to get 20% off!
Special discount code: IOSD20