Category Archives: iPhone

Cloudkit Fussiness in Xcode

Share this:  

Well, I’ve started to mess around with Cloudkit. And, before I could get out of the gate, before I could write a line of useful code, I ran into some troubles. These are probably due to my unique quirky circumstances. But then again, there are probably a small handful of developers who may have run into some of these problems and perhaps my blunders and lessons learned may be of help to you.

First of all, the Cloudkit Dashboard only “kind of” worked.

  • First problem here: I created my developer Apple Id a long long time ago when it could be anything (as long as someone else didn’t have it already).
    • Now, various Apple tools want your Apple Id to be a valid email address. Mine was not an email address! Never had been!
    • First of all, I created a new Gmail account just for my Apple Development work.
    • Then I had to figure out the process for changing my Apple Id. I dreaded that I would have to re-log into everything, and have things blowing up left and right. It turns out the process was not that scary and I did not have to re-log into everything! Phew!
    • The nasty messages about needing to have my Apple Id be an email address went away.
  • Second Problem: my iCloud log on.
    • When trying to access the private database in my project’s container, it said that I wasn’t logged into iCloud. But I was logged in! I checked!
    • It turned out that I couldn’t just be logged in with any old log in. The iCloud log in in my System Preferences had to be the same as my developer log in. What a pain! But, once I changed that, all of a sudden things started working…
      • On the Cloudkit Dashboard, I created a new record type in my private db, added a couple fields to it, and added a couple indexes to it to boot!

For now, on my Mac, I’ve set up a separate developer log on. If that’s what I need to do to get things to work that is what I will do. There is still a bunch of other things I need to set up on this new user account to make it usable for more than opening Xcode and building apps.

I’d rather have a spot in Xcode where I could log into iCloud just for the apps I’m building. Perhaps it’s there? Am I missing something? If you know something that I don’t leave a comment below.

Current Progress on ‘The Game’

Share this:  

A lot has happened since my last post here:

  • I’ve written a crude SQLite wrapper in Objective C (separate project). And have begun work on a little program that will read words out of a text file and add them to a table in an SQLite database. The column containing the word will be indexed so hopefully there will be a quick lookup!
  • I’ve managed to download a text file that is basically a list of English words (not a dictionary since there are no definitions).
  • I’ve started going through this file removing words that are not applicable (based on the game’s rules). This is going to take awhile. There are a lot of words in this list!
  • I am planning on having another column in the table where the word will appear with all its letters in alphabetical order. This column will be indexed too. This is all part of a crazy idea I have as part of an algorithm for the computer to quickly pick words to form based on the letters it currently has… This is for when the user is playing the computer or the computer is playing itself … Attract Mode.
  • I’m still not done with this little program to build my SQLite database table.
  • Back to work I’ve done on the main Objective C game code…
  • The main game menu is up and running (though at this point only the Create Game button is working).
  • Ive got a general purpose game menu button selection method which purpose is to play a button select animation, which, when done running, will then call the proper method to run based on whichever button was selected. It looks a little like the Silkroad Online game menu button. “Part” of the SpriteKit animation is playing a button “click” sound. The sound file being played right now is just a placeholder sound until I can create/get the final sound file.
  • I’ve now gotten an Apple TV version of the project working! Yay! The projects are different, but both iOS and Apple TV projects are pointing to the same source code.
  • I’ve figured out how to run my app in Xcode on my actual Apple TV box that is in the same room! The room where my home office is, is also my wife and I’s den.
  • There is specific code that is called only when running on  Apple TV, iPad, or iPhone.
  • But there is a lot of common code that is run by every platform.
  • Speaking of Apple TV specific code, I was able to get game controller code working for it (at least for the Siri Remote). So, for now, I can use the Siri Remote to navigate through the game menu and select an option.
  • I’ve added to the existing data structures for tile spots and buttons information for how to handle which element should be navigated to based on how the user uses their game pad on their Siri Remote. I’ve only been able to test it with the menu buttons so far and it seems to work pretty good.
  • There is a SpriteKit animation associated with changing the highlighted menu button. Part of it plays a sound file (think of the sound playing as you move for movie poster to movie poster in Apple’s Movie app). The sound right now is just a placeholder sound as well.
  • I would like the animation above to include the tilting of the highlighted item like the Apple Movie and TV apps and the Netflix app does. I plan on using the SKAction they have now to do a “warp” of the sprite. We’ll see how that goes.
  • I’ve added code to create, display, and run a game timer. The player will get 3 minutes for their turn.
  • This game is a multi-player game. And hence it needs functionality coded in to provide that functionality. At this point, I am planning on using Apple’s GameKit to implement these features. Specifically, the features that were mentioned in the talk “What’s New in Game Center” that Megan Gardner gave at the WWDC 2016. Specifically the features around the usage of the new GKGameSession class. You can watch the video of this presentation here. I watched this video a couple months back during the process of doing some initial investigation on what I would need to do to get this game to be a multi-player game. And I found it’s content exciting. What she talked about seemed to be able to do everything that I wanted without me having to compromise anything that I wanted in the game functionality!

Current Problems and Road-Blocks:

  • Sound on Apple TV version of app going away.
    • Initially, this worked fine. But then it suddenly stopped working.
    • When I’d leave the app and go into another app, their sound effects still worked just fine.
    • I had not turned the volume down on my Apple TV.
    • I checked the code just to make sure that I had not somehow removed the code that played the sound effect. I had not.
    • When running the iPad version of the game, it still plays the sound effect (shared code).
    • This problem is not at the top of my list, but it is annoying and it will need to be figured out eventually.
  • The Big Problem: Finding GameKit documentation including code examples (especially using the GKGameSession class).
    • This problem is causing a lot of anxiety and frustration for me. I can imagine that its doing/done the same for other iOS/macOS/tvOS developers out there too. I (like them) would rather be solving problems in my game itself, not having to be an API forensic anthropologist untangling a confusing web of sparse clues! And I’m really reluctant to use one of my Apple Developer support tickets for something like this which (in my opinion) is really Apple’s fault.
    • Maybe I’m blind in one eye and can’t see out of the other, but Apple does not provide any on-line code examples for GameKit/Game Center. None. If its out there, its hidden really good!
    • The API’s syntax documentation is very sparse.
    • If you look up a class such as GKGameSession, in addition to the sparse documentation, and no examples, it says it Deprecated! Really??
    • Okay, they do mention on the page that it was deprecated for iOS 10.0, macOS 10.12, and tvOS 10.0. iOS 10.0 came out on September 13, 2016 (just found that out now). If this is true, this means that all these cool, new, and sexy features did not even last 6 months. I don’t know, that is hard for me to believe.
    • When I saw this I thought “well, there has to be a presentation in 2017 or 2018 (this year) where they mention the new changes and which classes have been deprecated.” There were none. In fact there were no new presentations on Game Center/Kit since 2016.
    • Okay, it seems that Apple gave GKGameSession the boot. If it did, it was real quiet-like. The 2016 presentation that that Megan Gardner gave mentioned at least one class that was being deprecated and how they were taking away the Game Center app. So, it would make sense that if as of September 13, 2016, that the GKGameSession class was deprecated, that at least there would be a presentation during WWDC 2017 covering any changes… and why those changes were made… Or perhaps at least a web page explaining all this?
    • I’ve seen in various spots on the web people asking questions about GKGameSession. Rarely getting any answers. And certainly none from Apple (even on their developer forum).
    • I can’t find any how-to tutorial info on the web on the subject. Lots of info on stuff like SpriteKit though.
    • No books covering the subject (at least not recently covered).
    • No courses in or Udemy.
    • I did find some stuff of interest out on Github that I am looking into. But it is definitely not something a dev could easily figure out how to piece it all together. What interests me is where did they get some of the pieces of code to help them fit it together? Somewhere that I don’t know about at least!
    • To be honest, I did find some code examples and a tutorial on using GameKit on But this tutorial was created in 2014. I want to use the newer features of 2016.
    • Well, I have several lines of inquiry for this problem. Mainly involving an attempt to contact certain people in hopes that they can connect me with folks who DO know the answers to these questions. Wish me luck!

Well, I went on a lot longer than I expected in this post! If you know where I can find the information I’m looking for, any help would be greatly appreciated.

What You Can Do with Web Apps in HTML5: A Response

Share this:  

Hello all, I felt the need to respond to a discussion that was had on Web Apps and HTML5 on the tech show “The Gillmor Gang”… the “Pinch and Spread” episode. What was said was interesting but it seemed to be that the gang was coming to conclusions based on too limited a view of what HTML  5 was capable of. The embedded video I hope explains it all more fully. Hopefully you can pardon my excessive use of vocal pauses (umm), and you will still get a good grounding of the potential that HTML 5 has and what it can to do for the mobile space.

Link to discussion on programmatically determining if the browser is running on a regular iPad or an iPad Mini:   Detecting iPad Mini in HTML5
How to Detect iPad Mini Using Javascript
Note regarding the two links above: After looking into this deeper it seems that the difference in the values for availableWidth and availableHeight are due to the different tab counts when testing this code. So this is probably not very useful after all. 🙁

Amazon link to book:   Building iPhone Apps with HTML, CSS, and JavaScript by Jonathan Stark. Note that I bought this also as an eBook on Apple’s iBooks and some of the page formatting in the reader there is really screwed up.

Related Posts:
Programmatically Determining if in Full Screen Mode in Mobile Safari

Programmatically Determining if in Full Screen Mode in Mobile Safari

Share this:  

Building a site that you want to be a web app on an iPhone, iPad, or iPod Touch?

Full Screen Detection:

Consider this meta tag:

<meta name="apple-mobile-web-app-capable" content="yes" />

If you add this to your Mobile Safari web page your page will open in full screen mode…  IF you added your page as a shortcut to your Home screen and IF you launched it from that shortcut! Otherwise if you open the page from the standard mobile Safari icon it will not be in full screen!

You might have seen how some sites have a popup balloon that points to the    button with a message on how to add to the Home screen. The popup only shows up when your not in full screen mode. How do they do this?

Mobile Safari has the following property:


If this property is true, we are in full screen. False, we are not in full screen!

Consider adding to your JavaScript function called by the page’s onload event something like the following:

if ("standalone" in window.navigator && !window.navigator.standalone) {   
   // code here to create a div displaying our help balloon and positioning it
   // properly on the screen.
} // end if 

Recommended Post:

Do you want to look into this subject in more detail? Ben Nadel has written an excellent post on his blog: Detecting iPhone’s App Mode (Full Screen Mode) For Web Applications.

A JavaScript Library:

Looking for  a JavaScript library that you can add to your project to do the work for you? Matteo Spinelli on his site has created one for you. Go to his Add to Home Screen page to find out all the details. He’s even got a QR barcode that you can use with your iPhone to test it out!

If you go to the test page on your iPhone in Mobile Safari it will do this little balloon animation on the screen where it slides from the top down so    that it ends up pointing at the  button (see screen shot below):

The JS Library is downloadable for free but Matteo will take donations via PayPal or Flattr.

Code. I have to say I downloaded the library and looked at the code. Matteo put a lot of effort into this thing. it supports multiple languages and does all sorts of fancy stuff! Enough said.

iPhone Cookbook

Share this:  

I got one of my books on iPhone programming from The iPhone Developer’s Cookbook by Erica Sadun. It’s been about two days now. I’ve been pouring over it at home and riding the train to and from work. I am finding it helpful. Will I realize my dream of getting an app in the iPhone App Store?

A Status Report

Share this:  

1 to 1s.
I’ve been doing quite a few 1to1 sessions at the Apple store lately. Mostly on Finalcut Express. I’ve learned quite a bit about it. I recently took a 1to1 on Garage Band. Got that pretty much down. If I want more I will have to migrate to Logic Express or Pro. I think Garage Band will meet my needs for now.

I’ve begun the process of getting my college transcripts to Devry. I plan on finally getting a bachelor’s degree. I want to finish what I started years ago!

YouTube Contest.
I entered a contest on Youtube to win a $300 light-kit. I didn’t win but it was allot of fun and I learned allot in the process.

Day Planner.
I got filler pages for my Franklin day planner. I think I now have the impetus (the fire in my belly) to put the thing to good use. Basically, to keep track of my schedule and the things I want to accomplish.

The wife and I just celebrated our 6th. Took an extra day off and went to the zoo. Very enjoyable day.

I’ve been able to be more mentally engaged. Though far from perfect. I am seeing improvement here and it is encouraging.

iPhone Dev.
Went to the July Cocoa-Head users meeting in the Apple store. was okay. Also signed up for the Chicago iPhone Dev Camp that will be in August. I need to devote some more time to this. I need to be spending more time reading through the on-line documentation.

The iPhone is Working Again

Share this:  

My iPhone is working again. It has been several days since this momentous occasion has occured.

I called Apple tech support and was graciously helped above and beyond the call of duty. It seems that I was missing a step in upgrading my iPhone OS. Thankfully, I was given the remaining step, tried it, and it worked!

My iPhone has Wigged Out!

Share this:  

Imagine that you are ready to go somewhere and want to bring your cell phone with you. I found myself in this spot at many of us do. I went to get it off the charger where it had been sitting 2 or 3 days. I’d been hanging around the house for that amount of time and had not needed it. —Is that possible?— 😀

I took my phone off the charger and was greeted with the purple screen of uselessness. –Well, not quite, if I needed to call 911 it would allow that!

Without me updating my phone, at all, my iPhone has become basically a brick. All it can do is make emergency calls (I will add a screen shot later).

It dawned on me that since I am part of the paid SDK beta, that maybe the version of the iPhone OS on my phone had expired, so, I went through the process of updating my phone/SDK/Mac to the latest version of everything. At least I think I did everything that I need to!

I was expecting it to work again. No dice! That is a bit disappointing to say the least. I’m planning on calling Apple tonight when I get home to try to resolve the problem. I’m glad I have a cordless bluetooth headset for my landline phone as I’m sure I can expect to be waiting in some tech support queue for some time.

Let’s see, for a reference the number I will need to call is:  

U.S. iPhone technical support: 1-800-MY-IPHONE (1-800-694-7466)

Got it from here.

Wish me luck!

iPhone SDK Beta: Some Progress

Share this:  

To all you bright programmers out there, getting the SDK working probably seemed to be cake. Not for me. Apple made things confusing. But I’m finally getting somewhere!

Getting the first app example working (which I downloaded off of Apple’s site) was an uphill struggle. I was trying to get the  Kalimba Finger Piano working on my iPhone. Downloading the right licence files, putting them in the right places. Not to mention the fact that when ordering the SDK it took me to the Apple store to purchase it and promised a delivery within 5 business days, and that I’d need to be at the ship address to sign for it… Buzzz! Wrong!

I have now downloaded and got running on my iPhone several of the examples that Apple provides. These examples look like they will help me understand how to do different things that I need to understand in order to accomplish my desired goal: A simple game that I have in mind.

Pete from Trails In The Sand: thankyou for your help.

I’ve got a binder set up where I’m keeping all my To-do lists, activity logs, and misc notes for my game. I’m trying to give structure to this thing. I dearly hope this won’t end up being another unfinished project. I’m hoping that the simplicity of the game I want to write will help me in this regards.

The next thing I’m planning to do is assemble one of Pete’s projects and get it working. I think this is the next natural step in progression. It’s one thing to get working a project where all the files have been pre-added, and everything is pre-configured and get it working, it’s another thing to take the piece-parts and do that yourself.

After that, I’m really going to start digging into the code. My to-do list is much more detailed but I think you get the idea.

Tip: When selecting an item in Provisioning, it means more than highlighting it. It means checking the checkbox on the item. This little issue had me wasting probably 2-3 hours of time trying different things.

1 2 3