Sprite Kit app crashes when run on real device and plugged into computer - ios

I just updated to iOS 10 on my test phone and Xcode 8. I ran the code migration and was running tests successfully on my simulated devices.
However, once I started trying to test on my real device things stopped working smoothly. After running my Sprite Kit game for around 5 - 10 seconds it would crash and render the phone inoperable until I unplugged it from the computer. After I unplug it the game runs as normal and is still really smooth.
This are the startup notifications printed to the console:
2016-09-15 22:20:49.490959 AppName[411:38688] [DYMTLInitPlatform] platform initialization successful
2016-09-15 22:20:49.684189 AppName[411:38634] Metal GPU Frame Capture Enabled
2016-09-15 22:20:49.684758 AppName[411:38634] Metal API Validation Enabled
This is the error I receive after the app crashes when the phone is plugged in:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-85.83/ToolsLayers/Debug/MTLDebugRenderCommandEncoder.mm:130: failed assertion `indexBufferOffset(12) + (indexCount(480) * 2) must be <= [indexBuffer length](960).'
(lldb)

try to disable Metal verification by editing the scheme:
(Command-Option-R)
go to the Options tab.
Set Metal API Validation to Disabled.
This worked for me...

I can resolve this, unchecking "Debug executable" in the Scheme

Command-Option-R
"Wait for executable to be launched"
manual run
works for me from time to time.

Related

Xcode 8 simulator extremely slow

I am running Xcode 8 on macOS Sierra 10.12.2, and there seems to be a problem with running the simulator on my first "Hello World!" app (simulating iPhone 7 Plus). As you can see, I am very new at app development.
The simulator gets stuck at the loading bar with the Apple logo for about 10 to 15 minutes, and then gives me the message of "The operation couldn't be completed. (Mach error -308 - (ipc/mig) server died)".
I dug around the web and found solutions suggesting to go to Product > Clean in Xcode, also Simulator > Reset Content and Settings... in Simulator.
After which, the system gets stuck at the spinning clock for about 20 minutes and gives me the error message "Unable to contact local DTServiceHub to bless simulator connection" (solution I found online tells me to "Reset Content and Settings...")
I'm just really lost here because the error codes seems inconsistent in ways I cannot explain. Maybe it is my laptop? (Early 2011 MacBook Pro 15" 4GB ram, 2.2GHz Corei7)
Thank you in advance for your effort to help me.
On older/slower Macs the first run of an App on a simulator will be slow like this and an error often occurs:
The Apple logo bit is the simulator initialising (just like a real device when you cold start it) - just be patient and let it finish.
The error I suspect is something in XCode timing out due to be excessive delay. If this happens don't clean, just re-run: the simulator should not need to re-initialise so everything should be quicker and on my slow Mac setup the error does not tend to re-occur (unless I shut down or close the simulator - in which case I have to wait for it to re-initialise again!)
Helpfully you can manage without getting a new Mac :o)
I usually do this on Xcode 8.3.3.
Uncheck Debug->Optimize Rendering for Window Scale
Check again Debug->Optimize Rendering for Window Scale
It will work now
No Xcode simulator is not slow, It may be because slow animation is checked
Select Simulator
Debug Option and uncheck slow animation
That's work for me. Hope it works for you

IOS bot error: Early unexpected exit, operation never finished bootstrapping -

I have a question regarding build error that occurs when bots perform UI testing.
When I just run the UI tests, it just works fine. However, whenever I use bots to run the UI tests, there is build error and I keep getting build error saying:
"Early unexpected exit, operation never finished bootstrapping -"
XCode bot error: Early unexpected exit, operation never finished bootstrapping -
Some proposed solution says that I have to skip the APNs.. In my case the alert came up since the application was trying to register of APNS and the
"App Name" would like to enable Notifications alert was displayed. Skipping the APNS registration for UI Tests will prevent the issue from popping again.
How can I confirm that the alerts are causing the problem? I was not able to check it since simulator shows nothing on CI machine when the tests are performed by bot. Also, could you please specify what steps should be taken to skip the APNS registration for UI Tests? I am using iphone 6s simulator.
I have been stuck here forever.
I would really appreciate your help!
Thanks!
The solution that worked for me was to use iphone 6s simulator (iphone 6s or iphone 6s plus). I was using iphone 6 and it caused me a lot of errors including this one.
The actual reason was that APNS registration could not be skipped using iphone 6 simulator whereas it could be skipped using iphone 6s simulator for me (App would like to enable push notification..). After that, addUIInterruptionMonitorWithDescription successfully worked for me!

calabash-ios physical device test, app starts but crashes

Running calabash-ios cucumber for simple iPhone app. Simulator is working perfectly. When trying on physical device, app loads, crashes, then loads again, and crashes again, on a loop.
Error message:
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Time out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
Logfile /var/folders/9s/yttj4cz93m98hqs6bfw2x8xr0000gn/T/run_loop20150522-12657-dr3m49/run_loop.out
2015-05-22 19:58:11 +0000 Fail: An error occurred while trying to run the script.
Instruments Trace Complete (Duration : 2.594758s; Output : /var/folders/9s/yttj4cz93m98hqs6bfw2x8xr0000gn/T/run_loop20150522-12657-dr3m49/trace.trace)
to run the script. UIAScriptAgentSignaledException
(Calabash::Cucumber::Launcher::StartError)
/Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:766:in `new_run_loop'
/Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:631:in `relaunch'
Steps:
loaded app-cal on device
ran in command-line using:
$ DEVICE_TARGET=udid BUNDLE_ID=com.company.app DEVICE_ENDPOINT=http://ip:37265
Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError
The probably cause of this is that the device is not enabled for UIAutomation. The device must be enabled for development. A device is enabled for development if it appears in Xcode's Device's window (Shift + Command +2) and you must enable on-device testing manually by visiting the device's Settings.app > Developer tab.
If you have recently upgraded the iOS version we recommend that you check the UIAutomation settings again and perform a restart. Often, after an upgrade, Xcode cannot download debugging information from the device. Look at Xcode's Device's window. The device must appear without any warnings.
Sometimes devices get into a bad state and Xcode cannot communicate with it. We recommend trying to interact with the device with Apple's Instruments to clear this bad state.
All this information and more can be found on the Calabash iOS Hot Topics page. https://github.com/calabash/calabash-ios/wiki/Hot-Topics#6-errnoeintr-interrupted-system-call

Calabash testing on iOS device starts app but freezes on "Scenario"

I have been trying to use Calabash to test some simple iOS apps. I was able to run the app on the simulator and all steps work fine. Now I want to test it on an iOS device, but I am having some problems. I run this command with all the necessary info:
BUNDLE_ID=... DEVICE_TARGET=... DEVICE_ENDPOINT=http://MY_IP:37265 cucumber
After a while the app opens in the iPhone and I get the usual information on console:
Feature: Running a test
As an iOS developer
I want to have a sample feature file
So I can begin testing quickly
Scenario: Example steps # features/my_first.feature:6
But it stays there forever. I left it for a while and it does nothing.
I have tried Appium, as well, for testing and it worked fine both on the simulator and on the iPhone, so I guess is not a problem with Profiles and the device itself.
What could be causing this issue?
My setup:
- Mac OS X 10.10.3
- Xcode Version 6.3 (6D570)
- iPhone 4 - iOS 7.1.2 (11D257)
- calabash-cucumber (0.14.0)
- cucumber (1.3.19)
UPDATE
Trying curl http://192.168.200.168:37265/version (as suggested by #alannichols) I get:
Failed to connect to 192.168.200.168 port 37265: Operation timed out
But I got my test to move to the first step executing the -cal target from Xcode (on the device) and running the command:
NO_LAUNCH=1 DEVICE_TARGET=... DEVICE_ENDPOINT=http://192.168.200.168:37265 cucumber
Still I am getting an error, but this time is a timeout error:
Operation timed out - connect(2) for "192.168.200.168" port 37265 (Errno::ETIMEDOUT)
Does it mean that I am reaching the iPhone by somehow I am not able to send requests?
If the app opens and nothing happens, it's usually to do with the device endpoint setting being incorrect. The app opens based on the bundle ID, but then calabash tries to interact with the app via the device endpoint.
Try running the app in the calabash console and if it behaves the same way as in your tests it'll be an issue with the device endpoint. Some ideas of things to check are that you're on the same network on the phone and the machine the test is running on, whether your vpn is interfering with the communication somehow or whether instruments is open on the test machine.
When the app is open you should be able to run
curl http://your.ip.address:37265/version
and get a response with the version number of calabash. If you can't get that then calabash won't be able to do anything in your tests.

iOS7 xCode 5, how to get crash logs from a development build on device?

I playtested the game that I'm making on my development iPad, while it was not connected to xCode. There were 4 instances where the game just crashed/closed.
If I remember correctly, these crashes should create a crash report which can be visible in the Organizer>Devices>Device Logs. However, upon checking this, I see only 1 (instead of 4) reports, most of which are marked as "unknown".
Is there a way for me to refresh the device logs, or make sure that my device does keep logs of all crashes that happened while not connected to xCode?

Resources