Bugs & Fixes: Solving 'circular loop' problems in iPhone apps

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

It started as an annoying symptom in one of my iPhone apps. It eventually led down a rabbit hole of “what if” scenarios and what to do about them.

The app in question was Goodiware’s GoodReader, an overall excellent file viewer app. After you select to display a document from GoodReader’s initial list of files, a set of controls overlays the screen. The controls include a Back button, needed to return to the file list. After a few seconds, the overlay fades—so that you have an unobstructed full-screen view of the document. To get the overlay to reappear, you tap on the screen.

GoodReader for the iPhone

The problem I had was that, with certain documents (especially PDFs), a tap did not get the overlay to reappear. Making matters worse, GoodReader was set to automatically open where it last left off. This meant that, if I quit and relaunched GoodReader, it immediately returned to the problem document (without any overlay). There seemed no exit from this circular loop, no way to regain access to GoodReader’s file listings.

The backdoor solution

It turns out that the folks at Goodiware had wisely anticipated just this sort of dilemma. So they put in a back door exit. The solution is to quit GoodReader and go instead to the iPhone’s Settings app. From here, scroll down to and select the GoodReader item. Here you’ll see a way to turn off the “Reopen last file” option. Do so. Now, when you next launch GoodReader, it will no longer jump to the problem document, remaining at the file list instead. Success!

This is a fine work-around but it still leaves a number of unanswered questions:

How do you get the missing overlay to reappear?

The work-around does not solve the initial symptom of the overlay that would not reappear. It just avoids the immediate need for it. I contacted Goodiware for advice here. The developer told me to try a single tap right in the center of the screen. This seemed a bit counter-intuitive, as the overlay appears along the edges, which is where I had been concentrating my tapping. Regardless, I tried it; it worked. The overlay returned.

This was good. However, there is still an aspect of the symptom that remains unresolved. The area of the screen where a single tap will bring back the overlay is much greater for some documents than others. In my testing, it was only with PDFs that I had to restrict myself to a small spot in the center. For other types of documents, I could tap almost anywhere. This is why I initially thought there was no solution for PDFs.

What about the worst case scenario?

What if GoodReader (or a similar app) had failed to provide a backdoor “emergency recovery” setting? And what if even tapping at the center of the screen had not worked to bring back the overlay? What then? How would you ever break out of the circular loop (of the document automatically opening on every launch) so as to regain use of the app?

One solution is to delete the problem document from the iPhone. Without the document to open, the app should default to showing the file list on launch. You will also now have access to any settings within the app itself. Indeed, this is exactly how GoodReader responded when I tested this theory out.

How did I delete the document? I connected the iPhone to my Mac and launched DiskAid. (I could also have used PhoneView.) Because I was accessing files that I had transferred via USB, I could easily locate the folder that contained the relevant PDF file (it was in the Media -> DCIM folder) and select to delete it. Had the file been transferred wirelessly, this would not have been possible (as such files are stored in different locations, inaccessible from these apps by default, as I describe in this article).

If you are willing to jailbreak your iPhone, your chances of success increase dramatically. Now, you can locate the relevant folder, using the same DiskAid or PhoneView apps, no matter where the folder is on your iPhone. Alternatively, you could bypass your Mac altogether and use iFile (a Finder-like app you can download to your iPhone after jailbreaking) to locate the folder and delete the document. For example, using iFile, I entered “GoodReader” as a search term and quickly found the desired folder location for its wireless-transferred files.

What about a complete and permanent fix?

Even if you manage to delete the problem document or otherwise regain control of the file viewing app, your problems may not be over. What if the symptom recurs with most or all documents? In this case, even turning off automatic launching is not an ideal solution. You’ll still have to quit and relaunch the app each time you want to switch to viewing a different document. How do you completely fix this problem?

If the problem is due to a bug in the program code, there is probably nothing you can do except contact the developer and wait for them to issue a bug-fixed update.

However, just as with Macintosh applications, the problem may be due to a secondary cause, such as a corrupted preferences (.plist) file. This is especially likely if the symptom did not occur when you first used the app. If so, the solution is to delete the app’s .plist file. If you have a jailbroken iPhone, you can again use iFile to navigate to the relevant Library/Preferences folder and delete the app’s .plist file.

Otherwise, your best bet is delete the app from your iPhone and reinstall it. To do so, start by pressing down on the icons in the Home screen until the x’s appear and then select the x for the relevant app. When you do this, a message pops up warning you that this action “will also delete all of the app’s data.” Go ahead; this not only deletes the app but should also delete its .plist file(s) as part of the “app’s data.” Now reinstall the app (you can either download a fresh copy from the iTunes Store or use the existing copy in your Mac’s iTunes Library). Via any of these variations, you should wind up with a newly created default .plist file—hopefully with the symptom gone.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon