Sunday, July 09, 2017

Why Doesn't The Compass Work in Some iPhone Apps?

As a writer of apps—such as TV Towers USA—which rely on the device's compass, I periodically would hear from users who don't see the compass in my apps. This confused me as they would also report the built in iPhone compass app working. And the apps worked perfectly well for me.

I've finally figured out what is going on. At some point, the users had turned off compass calibration in their location privacy settings. And since my apps are set to request calibrated data, the app gets no compass data at all.

So, to fix, open the iOS Settings app.

Tap the Privacy item:

Tap the Location Services privacy item:
Tap the System Services item (way down on the bottom):

If Compass Calibration is disabled, then this was likely your problem. Enable it.

And, I hope, your app will go from not having an active compass, to having one:

I should look into detecting this condition and warning the user. Hope this helps.

Thursday, February 23, 2017

True North and the iOS Compass App

I recently got a 2 star review for my TV Towers USA app.

This would be a nice app if it pointed in the right direction!  Most of the time its sense of

direction differs from the compass app.

How can that be? ⭐⭐

Well, the short answer is that the iOS compass app tries to act like an old timey compass where North means magnetic North, and TV Towers USA instead is displaying the direction based on North being the Earth's north pole. You can go into the settings for the Compass app, turn on "True North", quit the Compass app and from then on, it will act like a super-compass that can calculate the location of the North Pole based on both magnetism and location.

I've put together a short video to describe the situation, and how to configure the iOS compass app.

Thursday, November 03, 2016

Why an Ad Supported Model Isn't For Me

As always, I was grateful to get a 5 star review for Signal GH, my app to let HDHomerun users best point their antennas. 

⭐️⭐️⭐️⭐️⭐️ Very useful. - Does exactly as described. Very useful if you are aiming an outdoor antenna, especially on a roof or similar. Gives data that is all in one place and not easily found with other software. Kinda stings to buy an app that you only really need once or twice. Would be ok with ads built in to make it free as nobody needs an app like this very frequently.

I think this idea deserves a response.

I don't like apps with ads in them. As a consumer of apps, I don't download ad supported apps. I don't like the contortions ad support brings to an apps layout, and the lengths it drives developers to get more views.  So, I'm not inclined to use ads just on principle.

And even if I were so inclined. A little research indicates that a good ad rate would be $4 per 1000 ad views, or .4 pennies per view. Let's say that I could prolong the antenna pointing session long enough to squeeze 10 views out of my users, that would be 4¢ per user. Maybe, if I did a poor job in the first session, I could rake them back in for a second, so 8¢. I make $2.10 from a sale of Signal GH, and with that I'm far away from quit my day job territory, or even pay for my computer hardware territory. Nor is there a universe out there with 40 users for the app that will download a free version for every 1 that would pay for it, and if there were, how would I be able to respond to any tech support they needed?

Meanwhile my users have paid $100 for a decent antenna, $90-200 for an HDHomerun, plus cables, a pre-amp, connectors, paddle bits, drills, masts, grounding wires, and a TV. All of these cost more than the $2.99 they pay Apple for my app, and ending with a set up that will deliver free (ad supported) content for years.

So, no, I will not be moving to an ad supported model.

Sunday, October 02, 2016

On Typing Everything In - My Updated Web Site

I have a quirk of typing what most people wouldn't think type-able.

My wife was once going to be the stateside representative of a Beijing University department, and needed a business card. And as I wanted it to be a perfect business card, I typed the entire thing as EPS as in:

%!PS-Adobe-2.0 EPSF-1.2
%%Title: peking university logo.eps
%%CreationDate: 4/8/08 1:30 PM
%%BoundingBox: 0 0 50 50
{ circtextdict begin
/radius exch def
/centerangle exch def
/ptsize exch def
/str exch def
/xradius radius ptsize 4 div add def
centerangle str findhalfangle add rotate
{ /charcode exch def
( ) dup 0 charcode put outsideplacechar
} forall
} def
{ circtextdict begin
/radius exch def /centerangle exch def
/ptsize exch def /str exch def
/xradius radius ptsize 3 div sub def
centerangle str findhalfangle sub rotate
{ /charcode exch def
( ) dup 0 charcode put insideplacechar
} forall
} def
This was back when Postscript was fresh in my mind after rebuilding ChemDraw's Postscript sink, nowadays this looks about as confusing to me as it does to most of you. I will admit that doing text along a path in Postscript is not as easy as it sounds. 

And, of course, I write all the graphics for my iOS apps in raw SVG. This has been great for responsive design and reusability. as in this location dot/compass from my broadcast towers apps. 
It seems to me that a good way to learn something, whether it be Postscript, Swift, SVG or any other computer language, you have to roll up your writing sleeves and start typing. Thus, my goal the last month has been to learn CSS. As anybody looking at my sloppy Blogspot blog here can see, I have not been an expert in either HTML or CSS, and I have hopes of changing that. 

So, I took my old iWeb website (yes, I was still using iWeb) and wrote a new one from scratch in pure HTML/CSS. No Javascript, no Typescript, no frameworks or templates. The new meets my simple needs and is pretty nice, I  think, for somebody with so little experience with modern web page development. It's mobile first, responsive, and makes good use of many of the SVGs I use in my native apps. For instance, all the app pages, use the actual SVG I use to generate the PNGs for the app icons. 

It'd be nice if Safari supported my favorite SVG property: vector-effect="non-scaling-stroke" but other than that, the graphics just work and make for some very light pages, and graphics that scale as the size of the page changes. If you are on a desktop browser, go and see how the icons on my home page scale smoothly with the size of the page. Extra responsive and extra gratifying. 

Maybe now, I can get to work on my Swift CSS parsing project. 

Wednesday, September 14, 2016

When The Simulator Doesn't Act Like a Device

I had to pull Signal GH from the App Store two days ago because mach_absolute_time which is based on CPU clock cycles returns quite different values on my Mac Mini than it does on an iPhone 5S, and a quick hack I had done to fix the build for Xcode 8 resulted in a severely degraded user experience.

Well, thanks to the magic of Expedited Review, it's back in the Store. Thanks Apple and my apologies to any customers that had a bad experience.

Thursday, August 25, 2016

Apple Doesn't Make a Mac I Would Eagerly Buy

I've been using Macs pretty much exclusively since I walked into the computer lab at International Falls Senior High and saw one in 1984. I've never not owned one since I bought a Mac Plus at the University of North Dakota bookstore in 1989.  I'm happy with the 2012 Mac Mini I'm writing this with.

And there is not a Mac that Apple sells that isn't so compromised that I would consider it worth its asking price.

The MacBook

Great looking computer, would buy them for my kids or to take on trips, but a single USB-C connector and a 1.2GHz Intel Core m5 do not make for a general purpose computer. At some point, somebody is going to have come with a single cable replacement to Thunderbolt that will drive a 5K monitor. Until then, I'd feel like I was buying a disposable machine. 

MacBook Pro 13-inch

Yes, Apple is still selling the same MacBook they sold me in 2011, more or less. It did manage to pick up USB 3.0 ports. Can put an extra hard drive in it. But 802.11n WiFi? 1280×800 screen? I already have this excellent but out of date machine. 

MacBook Pro Retina

I use one for work, and it is a great machine. Plenty of ports. Beautiful display. Great trackpad. Adequate keyboard. MagSafe connector.  Solid as a rock. I guess I could see getting the 13" model. But to be my main machine it would need a lot more that 1TB of storage and unlike my 2011 MacBook Pro, there's no place to put an extra drive in it. Plus, why is the 15" $700  more than the 13"?

MacBook Air

Who, at this point, is going to buy a MacBook Air, with its ridiculously out of date screen?


The 5K Retina iMac is actually quite a nice looking computer, but I just cannot get around the idea of permanently tying a desktop Mac to such an expensive monitor. Also, a desktop Mac with pretty much zero internal expandability. I used to own a PowerMac 7600, now that was an expandability monster. Maybe if it were cheaper. 

Mac Pro

I could buy one if I needed the performance level, but I'd feel foolish given how it hasn't been refreshed in 3 years and still has an entry level price of $3000.

Mac Mini

The current Mac Mini is a compromised product crippled—I would guess—to keep it from taking sales from higher margin machines. I feel bad for the engineers tasked with taking the epically nice 2012 design and removing all traces of internal expandability or quad-core processors. I feel bad for Phil Schiller for having to introduce it. I feel bad for anybody who paid full price for it. I feel bad.

The Buying Trigger

I'm happy with my Mac Mini. In order for me to get out my credit card, a Mac would have to do something my current one can't. So, if there was such a thing as an affordable quad core 13" Retina laptop, with 2TB of storage, and it had a single connector that would drive a 5K display, that would be something I would buy on the first day of availability. Until then, I'd only buy a new Mac if an old one broke. 

Sunday, August 21, 2016

The Awesome Responsiveness of

I encounter a bug in Swift 3

I had this cool idea to enhance CGPath, create an extension which would add a convenience init method that would take an SVG formatted path string. How neat would it be to be able to write
  let frogPath = CGPath(svgPath: "M 170 207C139 183 40 199 41 109A18 18 0 1 1 56 75Q67 53 91 45A18 18 0 1 1 127 40C170 29 193 62 212 173L225 110Q241 70 252 120L253 156 C253 180 265 223 235 214Q210 210 215 242 C222 265 161 249 125 248") 
and have a complicated curve available for display. (I should say this all relies on other code in my brand new, and very incomplete Scalar2D project)

So, I opened up a new source code file and tried:

public extension CGPath 
 public convenience init?(svgPath: String)
  guard let mutableSelf = CGPath.pathFromSVGPath(svgPath) else
   return nil
   return mutableSelf.copy()

Now the compiler didn't like this and told me I couldn't assign to self, and I couldn't figure out how to do what I wanted, so I turned to CGMutablePath, which I could mutate in the init method. I therefore tried

public extension CGMutablePath
 public convenience init?(svgPath: String)
   if !self.addSVGPath(svgPath)
   return nil
And the compiler promptly crashed. I had found a bug in the pre-release Swift 3 compiler.

I report the crash

In the olden days before Swift had been open sourced, if I could find the energy, I would find my way to the Apple Bug Reporter and enter my bug, never knowing if I was the first or the millionth person to encounter my problem. And it would sort of disappear, unless a request would come back sometime later for more information, or it was marked as a duplicate, or whatever vaguely unsatisfying outcomes would manifest.

For example, a bug I reported against Safari 8.0.6 in June of 2015, 21364634 Safari not Rendering SVG Gradients Properly, that has not been commented upon, nor fixed. But at least that is still open, most of my reported bugs have been archived, several with the rather insulting description of Insufficient Information, no they have plenty of information, with steps to reproduce and in one case even an Xcode project I took the trouble to generate. Others were tersely marked as duplicates, and one was operator error on my part when using MKPolygonRenderer.

But, this is the new era of open source Swift so, I made my way to  and discovered not some custom tool, but honest to goodness JIRA, the same tool I've used in many projects over the last several years. Wow, this was new. I could browse through the bugs and see if what I was seeing was already reported. Didn't seem to be. So, I opened up a new issue, simplified my steps to recreate to something you could type into the command line REPL and created my issue: SR-2338 Compiler Crash on Implementing Optional convenience init of CGMutablePath

The Awesomeness of Responsiveness

Within hours, someone with an Apple email address replicated the bug, and commented upon it in the JIRA issue for all to see. And a back and forth ensued amongst team members about what to do, where the bug came from, and possible solutions. My particular bug came from an initiative to give Core Graphics a more Swift-like object interface instead of the traditional C style interface. Nobody had considered the idea of testing if adding a convenience init method would work. Code and test cases were generated and a pull request was offered where anybody could comment on the pull request. When the resulting code wasn't right, an other approach was taken wherein the compiler just wouldn't allow you to extend Core Graphics objects this way, and a better fix would be delayed.

All of this was done in full view of the world, where anybody with an interest could contribute. And the final release of Swift 3, will be more reliable for it.