Figuring out iOS crashes

I was troubleshooting some iOS crashes with the team today and remembered this post I’d saved by Matthijs Hollemans, My App Crashed, Now What? It’s a great introduction for anyone starting to pick apart all the wonderful ways an iOS app – and more generally Objective-C – can break.

There’s plenty here to make me yearn for the helpful stack traces in Java once in a while (possibly the only thing I prefer about Android development…), but it’s all good stuff to know if you’re supporting a widely used iOS app in production. Enjoy!

,

1 Comment

Fixing Xcode 5 DP3 storyboard could not be opened / verify document content error

After updating from Xcode 5 DP2 to DP3 I found that several storyboards in my iOS project could no longer be opened, and would also prevent the project from building, with an error like:

The document “MainStoryboard_iPhone.storyboard” could not be opened. Could not verify document content.

storyboarderror

Interestingly it did not affect several storyboards which hadn’t been touched in awhile, and for those exhibiting the problem some trial and error revealed that deleting the table view inside certain view controllers fixed it. Of course, recreating table contents with all of the layout and segue intricacies is not ideal so I poked around further using Open As Source Code and noticed that the suspect tables had become tableViews inside a viewController (versus tableViewController) which was now failing verification.

I’ve actually run into this problem before when a developer manually added a UITableView to a plain UIViewController, either by accident or because they changed their mind partway through the design, and saw unintended side effects. But in this case it seems to have started out just fine and been mangled by Xcode 5 somewhere along the way. In any case, using Open As Source Code and manually changing the involved XML tags fixes the problem, allows Xcode 5 DP3 to open the storyboard, and most importantly preserves all the content without deleting anything or disabling auto layout.

For example, change:

<viewController storyboardIdentifier="MyScreen" id="Brq-Jb-DRf" customClass="MyScreenViewController" sceneMemberID="viewController">
                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="70" sectionHeaderHeight="22"
...
</viewController>

to:

<tableViewController storyboardIdentifier="MyScreen" id="Brq-Jb-DRf" customClass="MyScreenViewController" sceneMemberID="viewController">
                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" allowsSelection="NO" rowHeight="70" sectionHeaderHeight="22"
...
</tableViewController>

If you’re seeing this error without the scenario above there may be other similar problems that now fail Xcode validation which are also solved by a quick fix in the storyboard XML. I’d recommend deleting scenes or objects in the storyboard until things work, then add back a new/empty version of the object causing the problem, compare source, and if it’s a simple fix then revert and update the XML yourself similar to above.

Please comment if you find any others and I’ll add them here.

,

5 Comments

Terrorism at the Boston Marathon

As a runner and first-time marathoner last fall I was shocked along with the rest of the country at the attacks out of nowhere at today’s Boston Marathon today. I can’t imagine being caught in the midst of this only feet from the finish line. It’s such a great race that won’t ever be quite the same after this. There aren’t really words to describe how disgusting it is for anyone to be killed or maimed at such a fun, open, and historic event. But, I still want to run it and know they’ll pull it together, stronger than ever, in the years to come.

I also realized I’ve now posted twice in row about something terrible happening with crickets in between. This isn’t intentional, and I actually have plenty else going on that’s blog-worthy, but it turns out living life takes precedence over blogging about it sometimes. Even so, I’ll try to stop procrastinating and get it up here. Starting tomorrow.

For now my thoughts are with the runners, friends, and families in Boston tonight.

,

No Comments

A sad day, and a time for action

Today was an incredibly sad day with 26 people – 20 of them little ones – gunned down at school in Connecticut. What’s sadder still for me is that it’s only the most recent of increasingly frequent massacres of this type, and it’s getting worse at an alarming rate. I usually absorb these sorts of events privately, but the fact that today’s killings are on an especially large and senseless scale involving so many young children not much older than my own is compelling me to say more.

I still remember clearly the Columbine shootings in Colorado, probably the first shooting that really struck a chord for me because it was in a school, and nearby. I was in high school an hour away in Fort Collins at the time, but my friend at the time (now my wife) was much closer, living only miles away and much more connected to what was going. While I processed that event through a sort of detached fear and horror that this could happen anywhere – like my school, or my friends’ schools – it’s having a much different effect on me the older I get, and especially now that I’m a father.

From the other nearby shooting at a theatre in Aurora to the rest around the country and finally today’s school killings, I’m deeply troubled that my son is going to grow up in an age where this is commonplace. I’m glad for his sake that at two years old the news is a blur to be ignored, and when I asked him how his day went he happily babbled on about friends and activities like nothing special had happened today. I know in just a few years these events are going to hit him more deeply, whether it’s across the country or somewhere nearby. It’s one thing to go through fire drills and have basic safety precautions in place. But the thought of schools everywhere sheathed in metal detectors with armed guards and routine drills around what to do while a gunman roams the halls and the reality of more massacres not being if, but when and where they will occur, is more than I can put my head around and really makes me sick. No child should have the fear of being killed permeate their school. Of course I’m glad for anything that keeps my child safe, but I also can’t help feeling like it’s an un-winnable arms race as the frequency and severity of events like this keep climbing and we’re counting on school security measures alone to keep it in check.

Another big difference between Columbine and the recent shootings is how connected the world is by social media, and it’s probably only fueling my anger at the situation. While I read plenty of like-minded sentiments from friends completely fed up and disgusted with the state of second amendment paralysis in our country, it’s also not hard to find those quipping snidely that people kill people, take away the guns and they’ll just do it with a knife, or that if all the parents and teachers were armed to the teeth than a gunman would never make it past his first shot. My reaction is simple: that’s completely crazy. There’s a clear correlation between the level of gun control and the frequency and severity of gun violence in countries with stricter controls in place, and not just when it comes to the big-news massacre but with many types of violent crime. It’s even true on a muted scale with the different levels of state-imposed gun control in place in this country already. Limit the prevalence of guns and the opportunity and incidence of gun violence go down. Increase it and they go up.

I have no illusion that with tighter gun controls there won’t be sick people who set out to kill people in a school, theatre, or mall, but not letting them easily, legally, equip themselves with military-grade assault weapons will make a difference. In both today’s shooting and at the theatre in Aurora the reaction by authorities was by all accounts swift and thorough – they arrived in force within minutes, but it’s just not fast enough. The sheer volume of carnage that can be carried out by surprised with these types of weapons is more than any quick response will be able to intercept short of us living in a perpetual police state. The people who carried out these killings are directly to blame, are mentally ill, and we’re never going to fully get inside everyone’s head to curb that type of intent (nor do I think we should try). But we clearly understand and have control over the instruments they are using to carry it out with such vigor. Dozens of people aren’t going to be killed in seconds with a knife.

Probably the most ridiculous pro-gun argument I’m tired of hearing is the perpetual clinging to guns for self defense. You know, that in case some crazy guy breaks into my house or starts harassing me on the street I need to be able to shoot ‘em dead with my trusty handgun, therefore everyone should have whatever kinds of guns they want. Or when the government starts to really tread on me I’ll rise up and resist. Quite a bit has changed since the constitution was written and it’s infantile to keep propping it up with a sort of nostalgic colonial interpretation. We’re not talking about having a musket anymore, and statistics are clear that all forms of collateral and accidental injuries far outweigh the intentional ones by the average person owning a gun.

But what I find most ironic – and under-discussed – is that the capability of quick and efficient killing by modern firearms is matched by quite a few viable non-lethal options. Protect yourself with a taser if you’re really that worked up about it. If there’s a reason that instantly rendering an attacker unconscious or incapacitated isn’t good enough and you really have to be able to kill them, I’ve love to hear it. Especially since in so many high-profile encounters between law enforcement and civilians we expect the utmost restraint and non-lethal force handed down to the masses. If riot police can control a swarm of violent protesters with rubber bullets, water cannons, and tear gas I don’t see how the average Joe is somehow more entitled to instant lethal force at his fingertips for the by-and-large more mundane encounters he’ll need it for – if ever.

Basically, to the guns-for-everyone zealots I can only say this: I value my child’s life far more than your selfish fantasy of empowerment, and I truly hope we’ve hit a threshold of these tragedies where people who share a common-sense, pragmatic view of the tradeoffs between unbounded “liberty” and a safe world for us and our children are finally heard more loudly than you; loudly enough to give our politicians the courage to no longer be your hostage on the topic and finally enact some real change. This isn’t about hunting and self defense, it’s about your pride versus my son’s safety. I know progress happens slowly, and a lot of politicians and citizens alike are set in their ways, but the catalyst we have here is real and heartbreaking. Let’s not keep paying the price of children dying for our inaction. I have hope because there has been some real progress on other tough social issues recently – healthcare and LGBT liberties come to mind – and also because other parts of the world have turned a corner on gun control. I know on the macro scale it’s not the sort of inescapable human failing we dumb it down to be; individual bad people will always do bad things, but society absolutely has some ability and responsibility to shape the trend with thoughtful policy, and it can work if we have the courage to try.

Back off the progressive soapbox, if there’s one thing that heartens me about these terrible events it’s the love and protection that our teachers and others in the community show our children. It may shine through brightly when they’re calmly hiding kids away from a gunman or heroically throwing themselves in the line of fire, but they do it in a thousand little ways every day and as parents we are truly blessed by all those who give so much to our children when we can’t be with them.

I’m going to bed with a very heavy heart tonight, and I hope that by the time my son asks me to explain an event like this I can tell him that as sad and incomprehensible as it is, it’s something our country cares deeply about and is working hard to prevent. He deserves more than just a platitude about how these things happen and there’s nothing we can do about it, because there is.

,

3 Comments

First marathon!

I ran my first marathon, the Boulder Marathon, last week! After an intense but super fun past couple months of seemingly constant running when I wasn’t working, sleeping, or spending weekends and evenings with family (hence the lack of blog posts) I was totally ready and super proud to finally finish a big one.

I’ve been running casually since the end of college, at first intermittently between travel for work – something I did a ton of the first couple years after school – and then more consistently after getting married and being in town most weeks. But for a couple years this was once or twice a week for a mile or two at most without any thought put into distance, route, or pace, and I had no interest in signing up for a real race. Heck, living around Boulder I’m not sure that was even enough to call myself a runner!

Three events really changed this for me. First, watching the 2008 Summer Olympics four years ago which were first games where I was also running on a regular basis during them. I especially loved seeing Michael Phelps dominate, and after his last gold medal thought to myself, “if he can do that I can actually be more than half-assed at all these runs”. So I pulled up Google Maps and specced out an actual 5k, looked at the clock, ran it, and when I got back figured out my total time and pace.

Second, RunKeeper. This amazing app is an iPhone lover’s ultimate running companion. It’s beautifully designed, completely free of adds and other garbage (in both the app and website), and most importantly Just Works. After stumbling on it I was instantly hooked on running with my iPhone instead of the iPod Nano (despite the bulk – I have no problem with an armband!), hearing my distance and pace real-time each mile throughout my runs along with looking at my route afterwards. I know this is cliche to everyone who’s run with a stopwatch well before the existence of such niceties but as someone who entered adulthood with the advent of stats and achievements in online games, social media, and everywhere else it was perfectly natural and fun to have this immediate feedback as part of my runs. In fact, I craved it and immediately started getting much faster and more consistent. In no time I could feel my pace within +/- 30s per mile and knew the distances of every corner or landmark along the local paths. As RunKeeper added achievements proper I loved hitting them and it fueled me even more.

Third, having a kid. This was the most unexpected catalyst because I thought in advance the post-partem craziness would put running on hold, and depending how much free time I had left maybe even kill it altogether. But I was itching to run the day we came back from the hospital (and had a chance to, thanks to knowing grandparents who took care of everything for a couple hours while we did whatever we wanted that first day back!), and kept doing it whenever I could squeeze time in around lack of sleep and new baby wowness. Even more than before it became a crucial relaxation point of the day any time I could get a run in, and as opportunities for lots of other “fun” stuff evaporated it was one thing I could do solo and keep adjusting around any schedule. Then as soon as Cayden was old enough to ride in a BOB stroller, first in the little infant carrier and then eventually by himself in the big seat, runs became something even more amazing: a ridiculously epic trifecta of doing something fun that’s also great exercise for myself, an activity I can share with my son that he absolutely loves doing with me, and giving mama a break to do whatever she wants by herself while we’re gone.

If you don’t have kids you will not understand how rare and precious such things are, and I was totally surprised and thrilled at how much Cayden enjoyed it. He’ll ask to go on runs now, babbling, singing, pointing, laughing, or even snoozing the whole way, cheering when we get home, and never getting bored or complaining. I don’t know how he does it when he can’t even sit still for two minutes most other times, but I’m lucky. So within a few months of being into serious runs with a kid in tow I decided to up my game a little more and sign up for a real race, the Bolder Boulder. I ran it with a respectable time and kept running longer and harder after it, finishing the Sombrero Trail Run, Colder Boulder, and a few others over the next year.

By that point I’d had over a year of really solid running under my belt and was ready for another step. So this past spring I decided it was half marathon time, and I ran three of them along with the Bolder Boulder again in between. The first couple were mediocre, but by the third I was nailing my pace and ran every mile consistently getting in under two hours. At that point I decided it was time for the big goal: a marathon. Half marathons had always seemed in easy reach based on a starting point of being fit and running easy 10ks, but a full marathon was pretty daunting. It just didn’t seem like a whole lot of fun to run for that long, and even worse to do it for all the training lead up to it. But after a couple 15 mile+ hard runs pushing a BOB stroller the whole way (which I’ve come to realize is at least a 20% difficulty hit, but awesome way to make every step of a long run really count!), I knew I could do it. So I signed up for the Bolder Marathon and started putting in the rigorous mileage necessary to be more fully prepared than the half-assed training I had put in for any of the shorter races leading up. My first marathon was not going to be a DNF, and also not going to be walked through the second half!

Thanks to a great summer of training, especially all the long runs with running buddy Cayden along in the BOB and mama’s patience as the schedule did get crazy a few weeks, I went into race day totally ready. The weather was perfect, with beautiful fall colors on the Boulder backroads, clear skies, 50-60 degrees the whole time. I even had a random stray goat run along with me for a couple miles which was a hilarious little break from my usual focus. The first 20 miles felt great, and I actually blew through my half marathon PR over the leading 13. But if there’s one thing I’ve heard about marathons that rang true, it’s that they are a 20 mile warmup followed by a really fucking hard 10k. It was just stupid how drained I was over the last few miles, even with all the water, gatorade, and gels I packed in on schedule, and by the final mile I was really on my last legs. Still, that’s not unlike how the last few miles of my first half marathon felt, and more importantly I felt pretty great after a nap through the rest of the day, only a tiny bit of soreness through the rest of the week, and the next weekend I was out again enjoying a casual five mile run with Cayden.

So, I can do marathons, and they don’t make me hate life during or after – meaning I can probably push even harder. I’ve been thinking about it, and rather than just do more marathons I’m considering a couple goals: qualifying for and running the Boston Marathon, and really kicking it up to do an ultra marathon. Some high elevation or other particularly difficult marathons seem fun as well, and will give some nice variety to the slew of them I’ll probably run on the way to these goals, but having them out there gives me something else to focus on. That is, when I’m not working, sleeping, or raising a kid… just like when it all started! I will try to write more about it though. Reading about the running adventures of others has reminded me that it’s a worthy topic to pour myself out about every once in awhile.

In the meantime, I’m super proud to have knocked the marathon off the list and will now say without hesitation – even in Boulder – that I’m a runner.

,

No Comments