Tag Archives: iOS

Thinking outside the box to debug: Charles Proxy, push and a forced crash

An issue on just one device

A couple of weeks ago, one of my colleagues reported that she found an issue with the iOS app for AAFES EXTRA, an app that I had developed for BlueSoHo for their client The Army & Air Force Exchange Service.

The iOS app was not displaying the expected updated content.  The Android app was working fine.  To make things more difficult, the problem was only occurring on one specific device and could not be replicated on any other devices, even of the same model.

Continue reading

Advertisements

Sectioned table example with videos and articles

Sectioned Tables

I wanted to write-up the result of a code challenge that I completed a while ago.   I was asked to create a tabbed iOS app with sectioned tables, pulling video thumbnails and article titles into different sections.    Clicking on a thumbnail or article title would display the corresponding video or article in a separate view.    Adding to the challenge, I was asked to provide bookmarking capability for the videos and articles.  The bookmarked content would be visible in a second tab.

SectionedTable

Challenge Details and GitHub app

The full details of the challenge and resulting project can be found at:

Continue reading

Image manipulation using view transitions and transforms

Image Manipulation

I recently took on a code challenge that was delivered in an interesting fashion.   I was given a video that showed the manipulation of two images and was asked to create an iOS app that had the same behavior as the video.

ImageTransform

 

Requirements

After watching the video (many times), I extracted the following requirements for my app:

Continue reading

Logging and bookmarks with Objective-C and Swift

Overview

This article discusses the techniques I use for bookmarking code and adding log statements for both Objective-C and Swift.

ObjC_Swift_logging

Temporary Bookmarks

When I develop code I often find a need to temporarily reference different sections that I’m working on, either within the same file or in many different files.   Prior to Xcode 4 there was apparently a means to set and jump to bookmarks with keyboard shortcuts as mentioned in the article Killer Xcode Tips and Tricks – Tips 1 to 10 (see tips 7 and 8).

Continue reading

Xcode simulator bug with Swift to Objective-C call passing CMTime structure

CMTime Bug

I was in the process of creating an illustrative Swift project that performed some video conversions when I ran across an interesting bug.

The bug first manifested itself when I was attempting to set the opacity of a AVMutableVideoCompositionLayerInstruction object as part of a method that was creating a AVVideoComposition object.

videolayerInstruction.setOpacity(0.0, atTime: mytime)

Here mytime is a CMTime structure that is the AVAsset duration.

When I ran this on the simulator, I got an exception with the message “The time of an opacity setting must be numeric.”

Debugging the error

After searching Google and the Apple Developer forums, I could not find any reference to my error message or any issue related to CMTime in this context.

Since I had used similar code in Objective-C, I started the process to narrow down the error.  I first attempted to call a simple Objective-C method from Swift that would set the opacity (passing in videolayerInstruction as first arg and mytime as second arg).    This provoked the same error.  I discovered that the CMTime structure was corrupted in the Objective-C method.

Through trial and error I found that the corruption would not occur if I reversed the order of the arguments to the Objective-C call.    Corruption also did not happen if I passed the structure by reference.    A different structure type (I used CGSize) also did not encounter any corruption.

Specific situation

The end result of my investigation was that the error that I was seeing only occurred under very specific circumstances.  In particular:

  • Only with Swift to Objective C call.
  • Only on simulator with iPhone 4S and iPhone 5 configurations.
  • CMtime structure passed as second argument.

I suspect that the underlying issue may be a 32 bit versus 64 bit consideration since the iPhone 5S was the first device to introduce 64 bit processing.

Bug report and Github example project

An Apple bug report was filed today.   An example project has been uploaded to Github at https://github.com/scottcarter/CMTimeBug