I'm new to xcode and this forum, so sorry for my unprofessional language.
I have a problem with the iOS simulator crashing when I'm trying to run an app. It does not always happen, when I've just started working on a project everything's fine. But then suddenly after I just change something minor in the code the iOS simulator crashes as soon as it starts (compiling works). Xcode then takes me to the debugging page and also shows a lot of output in the bottom-right-corner-window (which I don't know what it's called). I don't get anything of the output, it says something about NSencryption. Once the iOS simulator has started crashing it will crash every time it starts running that project/app. Even if I undo my changes I did when it stopped working and even if I erase all of my code and everything looks like a new project, IT JUST WON'T RUN.
Tried to call Apple support to solve this problem, but they said I should post a question in a forum, hope you can help me as I am really getting tired of this, I can't build anything.
Btw I've tried to reset the iOS simulator but the same problem continues to occur.
Here is the output I get from the 'console': Btw, please tell me if any of this code is sensible and I will remove it.
2015-03-26 17:39:52.727 Testing123[19815:4331412] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Testing123.ViewController 0x7f93ea8272c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key addFive.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001026e1a75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104239bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001026e16b9 -[NSException raise] + 9
3 Foundation 0x0000000102afcd43 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010262b5e0 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010323b4ed -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x0000000103099a88 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010309a078 -[UIViewController loadView] + 109
8 UIKit 0x000000010309a2e9 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010309a77e -[UIViewController view] + 27
10 UIKit 0x0000000102fb9509 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x0000000102fb98a1 -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x0000000102fc5f8c -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x0000000102f700c2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
14 UIKit 0x0000000102f72e3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
15 UIKit 0x0000000102f71d35 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x0000000105deb243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
17 CoreFoundation 0x0000000102616c7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010260c9c5 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010260c785 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010260bbc6 CFRunLoopRunSpecific + 470
21 UIKit 0x0000000102f717a2 -[UIApplication _run] + 413
22 UIKit 0x0000000102f74580 UIApplicationMain + 1282
23 Testing123 0x00000001025051ee top_level_code + 78
24 Testing123 0x000000010250522a main + 42
25 libdyld.dylib 0x0000000104a15145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This is the code that gives me this error:
` import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}`
Here is the project
You haven't given many details, but here's how to start resolving your problem.
The bottom of your Xcode app has a debugger window. In that window, messages from the app will display. When your app crashes, it will print out a stack trace which shows what happened just prior to the crash.
When posting here, you'll want to include that in your post. Within that crash log, the top portion will tell you what the problem was--typical issues are nil values or calling something outside a range. Looking further down in the crash log, you'll usually see system stuff (UIKit, etc.). Look at the most recent method called in the class YOU created. Then, find that method in your code and add a breakpoint next to it. The breakpoint will stop execution of your code when it gets to that spot. At the top of the debugger window in the bottom portion of your screen, you'll see a few buttons. One of them is "step over". When you hit your breakpoint, use the "step over" button to execute your code one line at a time. When you get to your problem, it'll crash.
You'll also want to Google the error the debug console spits out. 9 times out of 10, someone's encountered the issue you're encountering and you'll be able to proceed towards resolution of your problem. If that doesn't get the problem solved, you'll want to post here with details and the problematic methods.
Another thing I'd recommend doing is learning how to use GitHub. When I started learning this (and I still AM learning it), git seemed like overkill, but in hindsight it would have been a good idea to learn how to use git from the start. You'll be able to create branches to work on features in your software and merge them to a "master" when you've got new features working. When I was starting, I would get fairly far along, I'd make a minor change and I'd break a bunch of stuff--that will still happen with Git, but you'll have a version of the software that functions. Using Git, you'll be able to always have a stable version that works and you can add features without worrying about blowing up your entire project.
Good luck!
Update for new info:
Your starting point would be Googling this: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: ViewController setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key.
Also, the import UIKit should be #import UIKit. I suspect this post will steer you in the right direction.
What does this mean? "'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X"
Solution:
You have a ViewController.swift file, but your storyboard file is
1) incorrectly named and
2) doesn't have any scenes on it.
Here's what you need to do:
1) rename the storyboard file "Main.storyboard"
2) add a View Controller scene on storyboard, as you currently have no scenes on your storyboard. You do this by dragging & dropping View Controller from the lower right-hand portion of the screen.
3) When your ViewController scene is highlighted, at the top right-hand portion of your screen you should see some buttons. One of them is called "Attributes Inspector". Make sure "Is Initial View Controller" is checked. One button over to the left is "Identity Inspector". Make sure class is set to ViewController.
I'll say it again. If you want to learn iOS, I'd recommend learning GitHub first. Additionally, Stanford University has a free iOS course taught by a guy who worked closely with Steve Jobs which you'll probably find helpful. If it's "too much" starting out, I'd suggest picking up a Big Nerd Ranch book or looking at Ray Wenderlich's website.
The pertinent part of the error message is:
"[<Testing123.ViewController 0x7f93ea8272c0> setValue:forUndefinedKey:]: this class is not key value coding-compliantfor the key addFive.'
Look for where you are using addFive. That is not defined for the instance yu are using it with.
Related
It might be a beta-prerelease-bug in Xcode, but did anyone other experience the same thing?
I clean the project - Run it - Everything's fine.
Then I stop the project - Run it again - just a black screen and this log:
2015-08-03 23:22:30.743 XXXXXXX[12221:2892479] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'MainStoryboard' in bundle NSBundle </private/var/mobile/Containers/Bundle/Application/920917A0-44DF-4B5F-91A8-BB669DDF5F0D/XXXXXXXX.app> (loaded)'
*** First throw call stack:
(0x1822542d8 0x193f200e4 0x18728e810 0x186f59edc 0x186f59074 0x186f5770c 0x18aa893c8 0x18220c27c 0x18220b384 0x1822099a8 0x1821352d4 0x186d383d0 0x186d32f40 0x1001ac504 0x1945caa08)
libc++abi.dylib: terminating with uncaught exception of type NSException
Then I can clean it and do the same thing all over...
And yes, the storyboard is added correctly. It's also added correctly in the info.plist and I have also tried to remove it and add it again. With the same result.
UPDATE I
Same thing happens in the latest Xcode Beta 5.
UPDATE II
This is the log from the second time I ran it in a simulator.
2015-08-10 12:09:19.552 XXXXX[32346:418981] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'MainStoryboard' in bundle NSBundle </Users/johndoe/Library/Developer/CoreSimulator/Devices/9685DA45-378D-48AC-BF8C-0DD2EF24C9B3/data/Containers/Bundle/Application/17882AD9-E024-41A1-9E9B-9DC2C2845EA5/XXXXX.app> (loaded)'
*** First throw call stack:
(
0 CoreFoundation 0x00000001116e69b5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000112927deb objc_exception_throw + 48
2 UIKit 0x000000010f4564f7 -[UIStoryboard name] + 0
3 UIKit 0x000000010ed9b310 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 58
4 UIKit 0x000000010ed9b664 -[UIApplication _loadMainInterfaceFile] + 260
5 UIKit 0x000000010ed99fc9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1383
6 UIKit 0x000000010ed97390 -[UIApplication workspaceDidEndTransaction:] + 188
7 FrontBoardServices 0x000000011347b7ac -[FBSSerialQueue _performNext] + 192
8 FrontBoardServices 0x000000011347bb1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45
9 CoreFoundation 0x0000000111612b21 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
10 CoreFoundation 0x0000000111608a4c __CFRunLoopDoSources0 + 556
11 CoreFoundation 0x0000000111607f03 __CFRunLoopRun + 867
12 CoreFoundation 0x0000000111607918 CFRunLoopRunSpecific + 488
13 UIKit 0x000000010ed96d2d -[UIApplication _run] + 402
14 UIKit 0x000000010ed9b99e UIApplicationMain + 171
15 Teazr 0x000000010e78912f main + 111
16 libdyld.dylib 0x0000000112ecc92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Could it be some kind of Facebook bug in the new SDK?
Update Xcode to stable version.
Judging from the crash log, it's apparent that Xcode can't find MainStoryboard.storyboard in the App's Bundle. Here are steps I would recommend you take so that the problem ceases.
1: Make sure the storyboard actually exists.
This involves opening Finder, going to the project's directory, and confirming that MainStoryboard.storyboard is, in fact, in the project's folder, it exists, and that it is readable/writable.
If the storyboard doesn't exist, skip to step 3. Otherwise...
2: Remove the reference to MainStoryboard.storyboard from within the Xcode project.
On the file list to the left, click on MainStoryboard.storyboard to select it. Afterwards, hit [Command] + [Delete].
On the alert box asking you whether you want to move the file to the Trash or simply Remove Reference, click Remove Reference.
3: Add the Storyboard back in.
Bring up the dialog to add the storyboard back to the project like so:
File -> Add Files to Project...
Navigate to the project's folder and add MainStoryboard.storyboard back in.
4: Tidy up the project, build, and run again.
Simply clean the project, build it, and try running it again. Twice.
5: Re-install Xcode.
You heard me right. Delete Xcode, and all files it has in the Library, off of your Mac and install it again. This issue might be caused by a screwed-up install, and so you might need to uninstall it and install it again.
A more technical explanation:
The code cannot find MainStoryboard.storyboard, as it appears not to exist in the App's Bundle. To those uneducated about the bundle, it is also known as the "binary." The Bundle is where developers put resources that the app needs to access locally. On build, Xcode (should) put(s) all files that are in the Bundle and makes it a Bundle.
Removing the reference and re-adding it back in should get it to always add it to the bundle, not just on every second run.
If MainStoryboard.storyboard is not readable, or it is not writable, Xcode will not include it in the Bundle.
Why it would only work 50% of the time is weird to me, as Xcode 6 runs every time. Making a brand-new project and running it shouldn't cause errors in the compiler, as every new project is created from a template.
If Xcode isn't executing the code that Apple's Developers put in a template (such as SpriteKit's default "Hello world!" message), then there's something wrong with Xcode. Un-install it and install it again.
To figure out why this problem occurs, more information is needed. Maybe we could show this to Apple and they might be able to fix this information by Xcode 7 GM!
I'm running corona SDK with a chartboost plugin, and I'm experiencing crashes about 20% of the time at startup, when I try to initialize the plugin (which I can't edit, I don't have the source).
Here's the symbolicated crash report: http://pastebin.com/id1AsjmN
I've been reading up a little on how to make sense of these crash reports, and from what I understand, these two frames in the main thread:
9 CoreFoundation 0x295d9008 +[NSException raise:format:arguments:] + 100
10 Foundation 0x2a2d8bc4 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 88
Are the most critical to understanding my problem. How can I understand what these lines mean? The "object:file:lineNumber:description:" and "raise:format:arguments:" business seems almost cruel, because I feel like those should be filled in with information that would help me -- what class, and line number we're talking about. Am I right? Are these placeholders in the error message? What am I not grokking here? Is there ANY way of knowing where this error came from?
It's not symbolicated crash log. To be more precise, partially symbolicated.
9 CoreFoundation 0x295d9008 +[NSException raise:format:arguments:] + 100
10 Foundation 0x2a2d8bc4 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 88
11 UIKit 0x2d00946e -[UINib initWithNibName:directory:bundle:] + 158
12 UIKit 0x2d00955c +[UINib nibWithNibName:bundle:] + 56
13 splashboardd 0x000bee8c 0xbc000 + 11916
Somewhere in your splashboard code something is called (0x000bee8c 0xbc000 + 11916 - not symbolicated). This calls +[UINib nibWithName:bundle:], which calls -[UINib initWithNibName:directory:bundle:], which causes your crash.
Google for How to symbolicate crash log and when you'll succeed, 0xbc000 + 11916 will be replaced with class name, method name, line number, ... That's the place where the problem is. Also that's the reason why you should keep debug symbols for your app as well. To be able to symbolicate it.
Also sometimes there's useful info in console as well. Additional messages, which can help you with debugging.
I'm trying to integrate some third-party SceneKit code into my app, and I'm experiencing a mysterious crash. Oddly, the crash gives no error or log in Xcode, and the stack trace is just "UIApplicationMain". No helpful info there.
The code works in the third-party app where I got it and I've copied it wholesale, so I know it must be some delegate call or some framework that I haven't included, etc. But this is my first experience with SceneKit so I'm having trouble closing in on what it could be.
The crash happens during an event where the user taps on the screen and a new 3D object is added to the scene. I've breakpointed all the associated methods, and the crash seems to be happening in the in-between time, presumably the internal SceneKit functionality, so I can't pinpoint it.
My Crashlytics report, though, did pick up some info, which I have included here:
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x00981ea8 _objc_empty_cache
1 SceneKit 0x015e0273 __28-[SCNPhysicsBody _setOwner:]_block_invoke + 214
2 SceneKit 0x016b05b5 C3DTransactionFlush + 2014
3 CoreFoundation 0x00bff86e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
4 CoreFoundation 0x00bff7b0 __CFRunLoopDoObservers + 400
5 CoreFoundation 0x00bf51ea __CFRunLoopRun + 1226
6 CoreFoundation 0x00bf4a5b CFRunLoopRunSpecific + 443
7 CoreFoundation 0x00bf488b CFRunLoopRunInMode + 123
8 GraphicsServices 0x043042c9 GSEventRunModal + 192
9 GraphicsServices 0x04304106 GSEventRun + 104
10 UIKit 0x01b99106 UIApplicationMain + 1526
11 SW LiveSheet 0x0007888a main (main.m:14)
12 libdyld.dylib 0x04e61ac9 start + 1
A search of my project finds no examples of SCNPhysicsBody _setOwner:, so I'm assuming that is an internal SceneKit method?
Does anyone know what might be causing a crash like this? I'll include any methods that might be relevant (if you tell me what they might be), but the series of methods to create the object is very long, so it didn't seem productive to blindly copy it all here. Plus, as I said, the crash seems to be happening "between the methods" anyway.
Does anyone recognize this error? Or are there any common "getting started with SceneKit" mistakes that I might be making, that could lead to this? I know the code works because it works in the other project, it's just a matter of what got lost in translation. Also, the scene does load successfully before the tap begins the process of adding the new object.
Can anyone point me in the right direction? Even just an idea of where to investigate would be appreciated.
Thanks for helping out a SceneKit newbie!
Weirdly, the answer ended up being just running the app on a device. I never could figure out what was wrong in the Simulator, but as soon as I tried running it on a device, it worked without changing anything!
Frustrating, to try to hunt down a solution for such a weird thing, but hopefully this will help anyone who experiences something similar.
If you're doing something with SceneKit and you're getting a bizarre error like this, try running it on a device before you tear too much of your hair out.
I'm searching for 5 days ago about this crash, but I can find why my app crash sometimes.
I'm using the Crittercism library to log my crash. The dSYM file is correctly uploaded on the Crittercism website. Here the crash log from Crittercism:
0 libobjc.A.dylib 0x38540626 objc_msgSend + 6
1 UIKit 0x307baaf7 -[_UIModalItemsCoordinator _notifyDelegateModalItem:tappedButtonAtIndex:] + 95
2 UIKit 0x307ba96d -[_UIModalItemAlertContentView tableView:didSelectRowAtIndexPath:] + 749
3 UIKit 0x306c205f -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1079
4 UIKit 0x30774377 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 215
5 UIKit 0x306236f5 _applyBlockToCFArrayCopiedToStack + 317
6 UIKit 0x3059c55b _afterCACommitHandler + 431
7 CoreFoundation 0x2dd532a5 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 21
8 CoreFoundation 0x2dd50c49 __CFRunLoopDoObservers + 285
9 CoreFoundation 0x2dd50f8b __CFRunLoopRun + 731
10 CoreFoundation 0x2dcbbf0f CFRunLoopRunSpecific + 523
11 CoreFoundation 0x2dcbbcf3 CFRunLoopRunInMode + 107
12 GraphicsServices 0x32bc0663 GSEventRunModal + 139
13 UIKit 0x3060716d UIApplicationMain + 1137
14 myApp 0x000c3357 main (main.m:16)
15 libdyld.dylib 0x38a43ab7 start + 3
The thing is: I have many UITableView in my app. But I can't find which one it is.
How do I have to process to debug this crash ? I didn't find some useful information on Apple Developer Center. I try to use the atos command to symbolicate the file, but no useful information. It's exactly the same info than on the Crittercism website.
Here the command I used: atos -arch armv7 -o myApp (to enter interactif mode, then, enter each memory address like : 0x307baaf7)
I have only the myApp.app.dSYM archive, and to use this command (above), I used the file the archive at path: Contents/Resources/DWARF/myApp
I'm really lost. Any idea ? Suggestions ? Thank you so much for your help.
EDIT 1:
I've checked all my UIAletView and delegate of UIAlertView: all is ok.
I see the crash log on Crittercism, (around 120 crashes for 63 users on iOS 7 only, iPhone and iPad).
I can't reproduced it ! I really don't understand.
Frame 14 already shows the correct symbol, which is main.m line 16. Using atos with the address as written in the stackframe like you did is wrong, see this stackoverflow explanation. As such it is not possible for a crash report to tell you which table view is causing such a memory issue.
Based upon the above you may not be able to get the exact table view from the stack trace itself, but with Crittercism there are additional features (such as Breadcrumbs) that allow for capturing a trail beyond just the stack.
My recommendation is to add a breadcrumb in the viewDidLoad of the TableViewController and grab/define the name of the table view there. That way you can step through the breadcrumbs and know that leading up to the crash you were in this tableview.
That should help you for better capturing this scenario in the future.
As for this particular stack trace. You can potentially use the techniques described in this post to help you better understand the true origins of the objc_msgSend.
* See the Kerni's response below in the comments *
My App does not crash on my iDevices, but the apple review team says it is crashing on ipad 6.0.1. This is the relevant part of the resymbolicated log:
Last Exception Backtrace:
0 CoreFoundation 0x327fb29e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x394dd97a objc_exception_throw + 26
2 UIKit 0x38897d54 +[UIStoryboard storyboardWithName:bundle:] + 436
3 UIKit 0x386da406 -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 38
4 UIKit 0x38563794 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 524
5 UIKit 0x3850bc34 -[UIApplication handleEvent:withNewEvent:] + 1000
6 UIKit 0x3850b6c8 -[UIApplication sendEvent:] + 68
7 UIKit 0x3850b116 _UIApplicationHandleEvent + 6150
8 GraphicsServices 0x35c8759e _PurpleEventCallback + 586
9 CoreFoundation 0x327d067e __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 10
10 CoreFoundation 0x327cfee4 __CFRunLoopDoSources0 + 208
11 CoreFoundation 0x327cecb2 __CFRunLoopRun + 642
12 CoreFoundation 0x32741eb8 0x32739000 + 36536
13 CoreFoundation 0x32741d44 CFRunLoopRunInMode + 100
14 UIKit 0x38562478 -[UIApplication _run] + 664
15 UIKit 0x3855f2f4 UIApplicationMain + 1116
16 MyApp 0x0007362e main (main.m:16)
17 MyApp 0x000735e4 start + 36
Does this mean that the Storyboard is the problem (line 2)?
To answer your question:
Does this mean that the Storyboard is the problem (line 2)?
It means that the most likely problem is related to the storyboard loading - either with the storyboard or the bundle - as that's where the exception is being thrown from. Without knowing the source code of UIStoryboard and what's on line 436 that makes it throw an exception, that's probably about as specific as you'll get from a non-Apple employee.
To get beyond that and actually reproduce the crash locally (so you can work toward fixing it):
Validate packaging / do a clean/fresh install (as suggested in the comments)
Try on a different device (perhaps there's something leftover that a clean isn't removing properly)
Try an older iOS version (maybe they're accidentally giving you incorrect information to the iOS version?)
Try simulating low memory environment while your app is in the background (maybe the crash is related to your app closing and restarting in the background in this situation?)
More likely you'll want to get more info from the review team than just a stack trace if you can't reproduce the issue:
Can you get more exact reproduction steps on how they are causing the crash?
Is this an update to an existing app? Might they have an old version of your app that hasn't been cleaned properly?
My guess is that at some point you changed the name of the storyboard file but did not reflect that change in Xcode under (project) > (target) > General > Deployment Info > Main Interface.
Consequently, it's still working on your device (because you still have the storyboard file with the old name installed on that device, as well as the new one), but it crashes when newly-installed on other devices, where only the storyboard file with the new name exists.