I am attempting to create an app in Xcode. I have added a stepper and a text box, and added outlets to the ViewController for these. When making an action to capture the change in stepper value, my code crashes upon clicking the stepper if I include any code at all in my changing value function.
Here is my ViewController.swift file:
import UIKit
class ViewController: UIViewController {
#IBAction func stepperValueChanged(_ sender: UIStepper) {
let newVal = Int(sender.value).description
self.valueLabel.text = String(newVal)
}
#IBOutlet weak var stepper: UIStepper!
#IBOutlet weak var generate: UIButton!
#IBOutlet weak var valueLabel: UILabel!
#IBAction func buttonClicked(_ sender: UIButton) {
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
It says my main thread sends signal SIGABRT in the AppDelegate file, which I have not modified:
import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
This is the console output:
2019-12-18 00:16:00.234618-0600 core[95979:16142343] -[NSLayoutConstraint setText:]: unrecognized selector sent to instance 0x600002c202d0
2019-12-18 00:16:00.240568-0600 core[95979:16142343] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSLayoutConstraint setText:]: unrecognized selector sent to instance 0x600002c202d0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c4f02e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50b97b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c6ff94 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c53dac ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c55f38 _CF_forwarding_prep_0 + 120
5 core 0x000000010c9fd5f3 $s4core14ViewControllerC19stepperValueChangedyySo9UIStepperCF + 643
6 core 0x000000010c9fd714 $s4core14ViewControllerC19stepperValueChangedyySo9UIStepperCFTo + 68
7 UIKitCore 0x00007fff47850dfa -[UIApplication sendAction:to:from:forEvent:] + 83
8 UIKitCore 0x00007fff4722ac22 -[UIControl sendAction:to:forEvent:] + 223
9 UIKitCore 0x00007fff4722af6c -[UIControl _sendActionsForEvents:withEvent:] + 398
10 UIKitCore 0x00007fff47be4a72 -[UIStepperHorizontalVisualElement _updateCount:] + 376
11 UIKitCore 0x00007fff47be473f -[UIStepperHorizontalVisualElement endTrackingWithTouch:withEvent:] + 33
12 UIKitCore 0x00007fff47258372 -[UIStepper endTrackingWithTouch:withEvent:] + 95
13 UIKitCore 0x00007fff47229e95 -[UIControl touchesEnded:withEvent:] + 427
14 UIKitCore 0x00007fff4788bc1d -[UIWindow _sendTouchesForEvent:] + 2604
15 UIKitCore 0x00007fff4788d524 -[UIWindow sendEvent:] + 4596
16 UIKitCore 0x00007fff47868427 -[UIApplication sendEvent:] + 356
17 UIKitCore 0x00007fff478e987e __dispatchPreprocessedEventFromEventQueue + 6847
18 UIKitCore 0x00007fff478ec344 __handleEventQueueInternal + 5980
19 CoreFoundation 0x00007fff23bb2221 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20 CoreFoundation 0x00007fff23bb214c __CFRunLoopDoSource0 + 76
21 CoreFoundation 0x00007fff23bb1924 __CFRunLoopDoSources0 + 180
22 CoreFoundation 0x00007fff23bac62f __CFRunLoopRun + 1263
23 CoreFoundation 0x00007fff23babe16 CFRunLoopRunSpecific + 438
24 GraphicsServices 0x00007fff38438bb0 GSEventRunModal + 65
25 UIKitCore 0x00007fff4784fb48 UIApplicationMain + 1621
26 core 0x000000010c9ff63b main + 75
27 libdyld.dylib 0x00007fff51a1dc25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
What could be the problem?
I have a quick look in debug console and I found something wrong. it's related to constraints, You are trying to set text in NSLayoutConstraint, Which is logically incorrect. Because NSLayoutConstraint doesn't have any property to set text.
Please review your code once and find out where you are trying to do like [NSLayoutConstraint setText:] or you can share your code with me, I can have a look on your code and fix it for you.
Related
UPDATE 2019/07/23 16:37:00 - I've updated the main storyboard script below in the original content. After trying several things and running into new errors that had to be corrected I have come full circle back to the same error message. Updated script and stack trace below. This time the stracktrace is referencing a 'null value' most likely referring to the following line of code but removing it does not remove the error unless that's a simulator's cache issue:
guard (URL(string: "http://southeastgeorgiatoday.com") != nil) else {
return
}
UPDATE 2019/07/22 20:01:00 - I have made some progress working with the referencing outlets and I finally have the app loading but now instead of crashing during the load, it crashes during the click event when an UIButton is clicked to load a UIViewController which which is a WKWebView. So now instead of crashing at the app load, it crashes on the click and loading of the webview. I have updated the script and the stack trace info.
Created actions for UIButtons to load wkwebviews via outlets.
Here is my storyboard script showing one of the uibuttons within it, there is a total of six of them but for the purpose of troubleshooting I've only included now of them here. They are all pretty much written in the same fashion making sure to identify the appropriate button and web view where applicable.
import WebKit
import UIKit
class UIViewController_sega: UIViewController, WKNavigationDelegate {
#IBAction func UIButton_sega(_ sender: Any) {
performSegue(withIdentifier: "WKWebView_sega", sender: sender)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let UIButton_sega = sender as? UIButton, let destination = segue.destination as? UIViewController_sega {}
}
#IBOutlet var WKWebView_sega: WKWebView!
override func loadView() {}
override func viewDidLoad() {
super.viewDidLoad()
guard (URL(string: "http://southeastgeorgiatoday.com") != nil) else {
return
}
}
func WKWebView_sega(_ webView: WKWebView, didCommit navigation: WKNavigation!) {}
}
Here is my AppDelegate.swift file:
import UIKit
import CoreData
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
func applicationWillTerminate(_ application: UIApplication) {
self.saveContext()
}
lazy var persistentContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: "SoutheastGeorgiaToday")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
I get the "Thread 1: signal SIGABRT" at this line in the AppDelegate.swift file: (this still remains the case only it happens during the WKWebView load after the UIButton click; where as previously it was during the app load and this time stack trace is referencing the class of the WKWebView 'WKWebView_s'; not the UIButton class 'button_sega' )
class AppDelegate: UIResponder, UIApplicationDelegate {
Here is my stacktrace
2019-07-23 16:37:01.980409-0400 SoutheastGeorgiaToday[1598:33823] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not create a segue of class '(null)''
*** First throw call stack:
(
0 CoreFoundation 0x000000010ebe71bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010c01c735 objc_exception_throw + 48
2 CoreFoundation 0x000000010ebe6f42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010ba1f877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 UIKitCore 0x000000011777555d -[UIStoryboardSegueTemplate segueWithDestinationViewController:] + 216
5 UIKitCore 0x0000000117775731 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 74
6 UIKitCore 0x00000001177756b9 -[UIStoryboardSegueTemplate _perform:] + 82
7 UIKitCore 0x000000011777597b -[UIStoryboardSegueTemplate perform:] + 157
8 UIKitCore 0x00000001175d4ecb -[UIApplication sendAction:to:from:forEvent:] + 83
9 UIKitCore 0x00000001170100bd -[UIControl sendAction:to:forEvent:] + 67
10 UIKitCore 0x00000001170103da -[UIControl _sendActionsForEvents:withEvent:] + 450
11 UIKitCore 0x000000011700f31e -[UIControl touchesEnded:withEvent:] + 583
12 UIKitCore 0x00000001171a8018 _UIGestureEnvironmentSortAndSendDelayedTouches + 5387
13 UIKitCore 0x00000001171a1fd1 _UIGestureEnvironmentUpdate + 1506
14 UIKitCore 0x00000001171a19ad -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 478
15 UIKitCore 0x00000001171a171d -[UIGestureEnvironment _updateForEvent:window:] + 200
16 UIKitCore 0x000000011761178a -[UIWindow sendEvent:] + 4058
17 UIKitCore 0x00000001175ef394 -[UIApplication sendEvent:] + 352
18 UIKitCore 0x00000001176c45a9 __dispatchPreprocessedEventFromEventQueue + 3054
19 UIKitCore 0x00000001176c71cb __handleEventQueueInternal + 5948
20 CoreFoundation 0x000000010eb4c721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x000000010eb4bf93 __CFRunLoopDoSources0 + 243
22 CoreFoundation 0x000000010eb4663f __CFRunLoopRun + 1263
23 CoreFoundation 0x000000010eb45e11 CFRunLoopRunSpecific + 625
24 GraphicsServices 0x0000000112e9f1dd GSEventRunModal + 62
25 UIKitCore 0x00000001175d381d UIApplicationMain + 140
26 SoutheastGeorgiaToday 0x000000010afca1c7 main + 71
27 libdyld.dylib 0x000000010f94b575 start + 1
28 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I have researched all references but they are all different and none of them mirror my exact situation and scenario. Like I said, I have tried the other articles and I see how they are similar, but it did not fix it so something is different; I just don't know what. When I do what it say I get other error messages that remove items changed and leave other items. What remains in my storyboard now removed all errors caused by the fix in the article individuals keep rerunning but then it still doesn't solve the thread 1 signal issue.
Since the latest update, I get the error
"libc++abi.dylib: terminating with uncaught exception of type
NSException
(lldb)"
whenever I try to connect to parse
I can't even perform a simple task like create a user, as it will always crash. I suspect something changed after Xcode's recent update, and I cannot figure out what it is.
I suspect it could be the libc++abi.dylib library not been supported, but I don't know what to do about this.
Here's my View controller
import UIKit
import Parse
class ViewController: UIViewController {
#IBOutlet var username: UITextField!
#IBOutlet var password: UITextField!
func displayAlert(title: String, message: String) {
let alertcontroller = UIAlertController(title: title, message: message, preferredStyle: .alert)
alertcontroller.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alertcontroller, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
#IBAction func signup(_ sender: Any) {
if username.text == "" || password.text == "" {
displayAlert(title: "Error in Form", message: "Please fill in the information")
} else {
let user = PFUser()
user.username = username.text
user.password = password.text
}
}
Here's my App Delegate
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
//--------------------------------------
// MARK: - UIApplicationDelegate
//--------------------------------------
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Enable storing and querying data from Local Datastore.
// Remove this line if you don't want to use Local Datastore features or want to use cachePolicy.
Parse.enableLocalDatastore()
let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = "......"
ParseMutableClientConfiguration.clientKey = "......"
ParseMutableClientConfiguration.server = "........"
})
Parse.initialize(with: parseConfiguration)
Here's the error
019-05-22 12:51:10.776625+0200
ParseStarterProject-Swift[18144:1046582] [MC] System group container
for systemgroup.com.apple.configurationprofiles path is
/Users/ejike/Library/Developer/CoreSimulator/Devices/8AAB1103-8B3E-4584-BFAE-170720DE4BEF/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2019-05-22 12:51:10.780381+0200
ParseStarterProject-Swift[18144:1046582] [MC] Reading from private
effective user settings.
2019-05-22 12:51:23.291890+0200
ParseStarterProject-Swift[18144:1046582] *** Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason: 'The
class PFUser must be registered with registerSubclass before using
Parse.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107dad6fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000107351ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000107dad555 +[NSException raise:format:] + 197
3 ParseStarterProject-Swift 0x0000000105f5a7e1 -[PFObject init] + 189
4 ParseStarterProject-Swift 0x0000000105f26533 $sSo6PFUserCABycfcTO +
19
5 ParseStarterProject-Swift 0x0000000105f25bdf $sSo6PFUserCABycfC + 31
6 ParseStarterProject-Swift 0x0000000105f25647
$s25ParseStarterProject_Swift14ViewControllerC6signupyyypF + 1383
7 ParseStarterProject-Swift 0x0000000105f25c3c
$s25ParseStarterProject_Swift14ViewControllerC6signupyyypFTo + 76
8 UIKitCore 0x0000000114799204 -[UIApplication
sendAction:to:from:forEvent:] + 83
9 UIKitCore 0x00000001141eec19 -[UIControl sendAction:to:forEvent:] +
67
10 UIKitCore 0x00000001141eef36 -[UIControl
_sendActionsForEvents:withEvent:] + 450
11 UIKitCore 0x00000001141edeec -[UIControl touchesEnded:withEvent:] +
583
12 UIKitCore 0x00000001147d1eee -[UIWindow _sendTouchesForEvent:] +
2547
13 UIKitCore 0x00000001147d35d2 -[UIWindow sendEvent:] + 4079
14 UIKitCore 0x00000001147b1d16 -[UIApplication sendEvent:] + 356
15 UIKitCore 0x0000000114882293
__dispatchPreprocessedEventFromEventQueue + 3232
16 UIKitCore 0x0000000114884bb9 __handleEventQueueInternal + 5911
17 CoreFoundation 0x0000000107d14be1
CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
18 CoreFoundation 0x0000000107d14463 __CFRunLoopDoSources0 + 243
19 CoreFoundation 0x0000000107d0eb1f __CFRunLoopRun + 1231
20 CoreFoundation 0x0000000107d0e302 CFRunLoopRunSpecific + 626
21 GraphicsServices 0x000000010cf112fe GSEventRunModal + 65
22 UIKitCore 0x0000000114797ba2 UIApplicationMain + 140
23 ParseStarterProject-Swift 0x0000000105f27dab main + 75
24 libdyld.dylib 0x00000001091a3541 start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type
NSException
(lldb)
I'm designing my first App, and am fairly new to Swift.
My app will build successfully, but won't go past the launch screen and gives the error "libc++abi.dylib: terminating with uncaught exception of type NSException". The other similar questions I found on this I attempted the fix but could not get it to work.
I am unsure if the problem is on my launch screen or on the view controller.
There is also a warning about "The use of Swift 3 #objc inference in Swift 4 mode is deprecated."
Is this what's causing the error?
Thanks in advance.
Launch Screen Code (App Delegate):
import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
View Controller Code:
import UIKit
class ViewController: UIViewController, UISearchBarDelegate {
//connection that ties search bar in view to input for viewcontroller
#IBOutlet weak var searchbar: UISearchBar!
override func viewDidLoad() {
super.viewDidLoad()
searchbar.delegate = self
}
//activates keyboard etc when searchbar clicked
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
searchBar.resignFirstResponder()
//(dncode) is string that will equal text as entered into search bar
let dncode = String()
searchBar.text! = dncode
if let url = URL (string: "https://www.example.com/(dncode)")
{
//this section to check and auto open URL in default browser "Safari"
if #available(iOS 10.0, *)
{
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url)
}
}
}
}
Log:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<DNAppBeta.ViewController 0x7fe1edd095e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key SearchBar.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d5ad1cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000109189f41 objc_exception_throw + 48
2 CoreFoundation 0x000000010d5ad119 -[NSException raise] + 9
3 Foundation 0x0000000108bac1e3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x000000010a17f41f -[UIViewController setValue:forKey:] + 87
5 UIKit 0x000000010a46e9dd -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010d55057d -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x000000010a46d393 -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x000000010a1864e0 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x000000010a186e0c -[UIViewController loadView] + 177
10 UIKit 0x000000010a18713d -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x000000010a18799a -[UIViewController view] + 27
12 UIKit 0x000000010a055ae3 -[UIWindow addRootViewControllerViewIfPossible] + 122
13 UIKit 0x000000010a0561eb -[UIWindow _setHidden:forced:] + 294
14 UIKit 0x000000010a069098 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x0000000109fdb521 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4711
16 UIKit 0x0000000109fe0751 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
17 UIKit 0x000000010a3a5e00 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
18 UIKit 0x000000010a778840 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
19 UIKit 0x000000010a3a59f9 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
20 UIKit 0x000000010a3a6257 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668
21 UIKit 0x000000010ad19dd9 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
22 UIKit 0x000000010ad19c92 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
23 UIKit 0x000000010a9fb87e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420
24 UIKit 0x000000010abf8e8e _performActionsWithDelayForTransitionContext + 100
25 UIKit 0x000000010a9fb67a -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
26 UIKit 0x000000010a777e9d -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
27 UIKit 0x0000000109fdefd2 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
28 UIKit 0x000000010a5b389b -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
29 FrontBoardServices 0x00000001145761b4 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
30 FrontBoardServices 0x000000011457eca9 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
31 libdispatch.dylib 0x000000010e60243c _dispatch_client_callout + 8
32 libdispatch.dylib 0x000000010e607af4 _dispatch_block_invoke_direct + 592
33 FrontBoardServices 0x00000001145aa6ce __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
34 FrontBoardServices 0x00000001145aa384 -[FBSSerialQueue _performNext] + 464
35 FrontBoardServices 0x00000001145aa8f3 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
36 CoreFoundation 0x000000010d5502b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
37 CoreFoundation 0x000000010d5efd31 __CFRunLoopDoSource0 + 81
38 CoreFoundation 0x000000010d534c19 __CFRunLoopDoSources0 + 185
39 CoreFoundation 0x000000010d5341ff __CFRunLoopRun + 1279
40 CoreFoundation 0x000000010d533a89 CFRunLoopRunSpecific + 409
41 GraphicsServices 0x00000001116e79c6 GSEventRunModal + 62
42 UIKit 0x0000000109fe223c UIApplicationMain + 159
43 DoughNationAppBeta 0x000000010886a557 main + 55
44 libdyld.dylib 0x000000010e67ed81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The problem is that
#IBOutlet weak var searchbar: UISearchBar! was
#IBOutlet weak var SearchBar: UISearchBar! before.
So when you attached search bar's IBoutlet in Interface Builder the name of the property was SearchBar. After that, you changed the name of the property in the code, and now you need to open interface builder and make a new connection with iboutlet. This will fix your issue.
New to Xcode 8 and Swift 3. Any help would be much appreciated. I've been doing as much research as possible but I'm still having trouble running my app without using the storyboard. Seems I get a black screen when I launch it in the simulator due to:
Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </User...........................app> (loaded)' with name '`main`''
*** First throw call stack:
(
0 CoreFoundation 0x0000000104099b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000101379141 objc_exception_throw + 48
2 CoreFoundation 0x0000000104102625 +[NSException raise:format:] + 197
3 UIKit 0x0000000102676e74 -[UINib instantiateWithOwner:options:] + 501
4 UIKit 0x0000000102679614 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 222
5 UIKit 0x000000010226f7ea -[UIApplication _loadMainNibFileNamed:bundle:] + 75
6 UIKit 0x000000010226fe13 -[UIApplication _loadMainInterfaceFile] + 260
7 UIKit 0x000000010226e4b6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1407
8 UIKit 0x000000010226b7f3 -[UIApplication workspaceDidEndTransaction:] + 182
9 FrontBoardServices 0x00000001057845f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
10 FrontBoardServices 0x000000010578446d -[FBSSerialQueue _performNext] + 186
11 FrontBoardServices 0x00000001057847f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
12 CoreFoundation 0x000000010403fc01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
13 CoreFoundation 0x00000001040250cf __CFRunLoopDoSources0 + 527
14 CoreFoundation 0x00000001040245ff __CFRunLoopRun + 911
15 CoreFoundation 0x0000000104024016 CFRunLoopRunSpecific + 406
16 UIKit 0x000000010226a08f -[UIApplication _run] + 468
17 UIKit 0x0000000102270134 UIApplicationMain + 159
18 testappfour 0x0000000100da2c57 main + 55
19 libdyld.dylib 0x000000010501b65d start + 1
20 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
AppDelegate.swift
import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
window?.rootViewController = UINavigationController(rootViewController: ViewController())
return true
}
ViewController.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
1) In project settings remove storyboard for 'Main Storyboard' setting
2) There is a typo in your code. View controller class is named ViewController but you instantiate ViewContoller ('r' is missed).
After doing those both things your code works well for me and project runs:
Check General>Deployment Info> Main Interface has still pointing to Main.storyboard? If yes remove it.
I am using CSStickyHeaderFlowLayout for Parallax Header in Swift. Xcode 7 swift 2.0 .
I tested the github swift demo. The app crashed when segueing to another view controller.
The log said:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'great1'
I also tested the github object-c demo code , segue works fine .
I found out the code below has the problem . it's in appDelegate.swift for the swift demo code in the repository . Does anyone know the solution keeping segue working while having stickyParallaxHeader like the pic below .
[]
[]
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let stickyHeaderFlowLayout = CSStickyHeaderFlowLayout()
let collectionViewController = CollectionViewController(collectionViewLayout: stickyHeaderFlowLayout)
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
window.rootViewController = collectionViewController
window.makeKeyAndVisible()
self.window = window
return true
}
below is the debug log .
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<collectionviewmapdemo.CollectionViewController: 0x7fdbdb01d600>) has no segue with identifier 'great1''
*** First throw call stack:
(
0 CoreFoundation 0x0000000108d50f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109116deb objc_exception_throw + 48
2 UIKit 0x0000000107919692 -[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0
3 collectionviewmapdemo 0x00000001051a6ba7 _TFC25collectionviewmapdemo24CollectionViewController14collectionViewfS0_FTCSo16UICollectionView24didSelectItemAtIndexPathCSo11NSIndexPath_T_ + 135
4 collectionviewmapdemo 0x00000001051a6c2f _TToFC25collectionviewmapdemo24CollectionViewController14collectionViewfS0_FTCSo16UICollectionView24didSelectItemAtIndexPathCSo11NSIndexPath_T_ + 79
5 UIKit 0x0000000107f91eb0 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:] + 701
6 UIKit 0x0000000107fb2d51 -[UICollectionView touchesEnded:withEvent:] + 574
7 UIKit 0x0000000107988663 forwardTouchMethod + 349
8 UIKit 0x000000010798872c -[UIResponder touchesEnded:withEvent:] + 49
9 UIKit 0x0000000107988663 forwardTouchMethod + 349
10 UIKit 0x000000010798872c -[UIResponder touchesEnded:withEvent:] + 49
11 UIKit 0x0000000107c3dca5 _UIGestureRecognizerUpdate + 10289
12 UIKit 0x00000001077f7592 -[UIWindow _sendGesturesForEvent:] + 1137
13 UIKit 0x00000001077f8681 -[UIWindow sendEvent:] + 849
14 UIKit 0x00000001077aa752 -[UIApplication sendEvent:] + 263
15 UIKit 0x0000000107785fcc _UIApplicationHandleEventQueue + 6693
16 CoreFoundation 0x0000000108c7d0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000108c72fcc __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x0000000108c72483 __CFRunLoopRun + 867
19 CoreFoundation 0x0000000108c71e98 CFRunLoopRunSpecific + 488
20 GraphicsServices 0x000000010b240ad2 GSEventRunModal + 161
21 UIKit 0x000000010778b676 UIApplicationMain + 171
22 collectionviewmapdemo 0x00000001051b555d main + 109
23 libdyld.dylib 0x0000000109c3f92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I finally sort it out .
Remove the above code from project, keep
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { return true }
Make sure the layout class is CSStickyHeaderFlowLayout, see the image below .