Best method for troubleshooting "hiccups" in xCode? - ios

I've been working on a small iPhone game using SpriteKit. Periodically the game will "hiccup" and freeze for a half a second before resuming (Activity monitor shows CPU usage drop to 0%). I don't really have a lead as to where things might be freezing up, and I'm unfamiliar with the tools xCode provides to solve these issues. I've experimented with setting up breakpoints and looking for where things freeze up, but I don't think it's the right way to solve the problem. What is the methodology for solving brief and seemingly random runtime issues that aren't easily reproduced?

Related

SpriteKit Scene Editor changes are not applied

I'm developing a game for iOS 9 in Swift, my testing device is a iPhone 6.
In Xcode I edited a .sks file with the help of the built in Scene Editor (changed the background color, added new nodes etc.). My problem is that these changes are not applied to my compiled game.
I tried following approaches but were not successful:
Clean the project before building it
Run the app on the simulator
Any ideas on what I am doing wrong?
Edit: I discovered that after closing the file through "File->Close" and reopening it the old content appeared again. Can somebody explain me why this was happening? I'm sure I saved the file before and were not editing another file.
SpriteKit and SceneKit Scene Editors are buggy, works in progress.
You'll find all sorts of quirks from one version to another. Unfortunately this might well be one of them. There's no consistency to these quirks and oddities.
There's also no descriptions of changes made from one version of iOS to another with regards Sprite Kit or Scene Kit, which is causing a great deal of annoyance because it's left to the small community to find the changes through trial and error and the sorts of experience you're having.
A compendium of issues would be helpful, and you'd think someone like Apple would have sufficient resources.
If corporations are people, too, then Apple is a poor communicator with attitude issues and a highly secretive nature.

Simple Javascript Sprite Animation - line flicker, but only on iOS devices

There is a problem with the sprite animation on the homepage of one of my clients, but it only appears when the site is viewed on an iOS device, namely an iPhone or iPad. I can't replicate the problem on any other device or emulator, so I'm having an issue troubleshooting it (don't own an iPhone or iPad). The problem is: what looks to be a 1px line is appearing on the right edge of the animation frame pretty much all the time, and a similar line flickers occasionally at the top of the frame as the animation runs. The animation itself is a simple javascript sprite sheet animation. I'm operating under the assumption that I have the sprite animation programmed correctly since it appears correctly on every other device, platform and browser I've checked. It even works in IE.
Two questions:
What would cause a simple sprite animation to display differently when rendered by iOS?
As a small business consultant, I don't have the time and my clients don't have the budget for me to physically test on every single device, so I have to rely on emulators. What other options do I have if the emulators don't properly demonstrate what the device will display?
I'm not entirely sure of the protocol regarding posting a link to my client's production website, but happy to send a link to anyone willing to help that responds and/or messages me.
welcome to SO.
I spend a lot of time working specifically with iOS on the web and have run into similar situations. Without tweaking an example you post I won't be able to prove it exactly, but this should at least give you direction.
Flickering or semi opaque lines are often caused by the scaling set to the asset. In the world of high DPI displays and fluid layouts, there are differences in rounding that result in fine lines, shimmers, et al. Is there any scaling set on the assets, e.g. background-size, downsampling?
The emulators are displaying the software correctly - these issues are a result of hardware. Best thing you can do is buy a flagship for all of the platforms you test on, or look into local resources like Clearleft's Device Testing Lab

UIWebview freezes when browsing?

I'm facing some problems when browsing trough our webshop using an UIWebview. It just freezes the entire app until loaded (which can take up to 15 seconds). After fast clicking to other categories my app stops responding to touches, but it seems memory and CPU stay stable (30-40mb and CPU stays very low).
I'm using multiple UIWebviews within a UITabbar controller. Anyone an idea what causes this problem? I seem to find multiple questions related to mine, but none solutions given which will also work for me.
I faced the same problem and found out it was caused by an Ajax script on my webpage which took to long. The UIWebview is not a great thing to use, but when the pages are stable, use not to many javascripts, it should work without facing high CPU.
So, take a look at your page, look at the javascript/ajax/jquery and let me know the result!

Sticky UITableView scrolling in Unity

I am building a UITableView-based Unity plugin which will be embedded by game developers into their Unity app. I am using the standard approach with dequeueing reusable cells, and the UITableViewCells contain simple UILabels and a UIImageView. The image inside the UIImageView is loaded via an asynchronous request.
There are no usability issues at all when launching the plugin as a standalone Objective-C app (in particular, scrolling works well with no lag) but when inside Unity, there is a "sticky" scrolling issue which arises randomly, i.e. the view scrolls but without inertia. I have not been able to pinpoint the exact actions which cause this behavior, but it happens usually when I scroll very quickly in one direction, or in short movements back and forth. The bug disappears when I scroll the view past the top or bottom (trigger the "bounce" effect, I am guessing this causes some hard refresh).
There is a very similar issue described here. The fix they suggest is to put
#define USE_DISPLAY_LINK_IF_AVAILABLE 0
inside the Unity-generated AppController.mm file. Unfortunately, this fix is unfeasible for the game developer who will be integrating our plugin, since it turns off the fastest and most reliable timing solution, and would require a fallback to other timing systems which would cause the game itself to lag or miss a portion of touch and accelerometer events.
I will most likely override drawRect for the UITableViewCells to reduce rendering time and memory usage, and if that fails, write a version of the plugin in OpenGL. However, I was wondering if anyone had a similar issue and knows a quicker fix, either in Objective-C or inside Unity, that is non-destructive (like the timing fix described above). Thanks very much.
I had the same trouble that you have described. I've fixed it by commenting the line
//#define USE_DISPLAY_LINK_IF_AVAILABLE 0

Core Text Performance Problem

I have been following a iOS tutorial on raywenderlich.com, called "How To Create a Simple Magazine App with Core Text" LINK
The App works great on the simulator, but when i build it for my iPad 1G, the scroll view is not fluent at all, the performance goes down, and the view becomes useless.
I have been trying to get help at the raywenderlich.com forum, but with no luck.
Is it a general problem with Core Text or what do you think?
Thansk
When trying to debug lag issues, try and find similar apps on the Store that are doing similar drawing. If your performance does not equal that level, then your code can obviously be improved.
For instance today, I was coding a UITableView, but when I ran it - it was not fluid in scrolling. I just knew that something wasn't right as the hardware could obviously handle it; looking at scrolling performance in the Music app for instance. So I used the profiler tools and eventually tracked down my error.

Resources