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.
Related
I'm new in XCode and I'm trying to create a simple Webview that displays www.google.com website
But the Code does not RUN. I got an Error: Threat1: Signal SIGATBRT
Here is my code:
import UIKit
import WebKit
class ViewController: UIViewController {
#IBOutlet var WebView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "www.google.com")
let request = URLRequest(url: url!)
WebView.load(request)
// Do any additional setup after loading the view.
}
}
Questions Update
import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { // <- The Error Pointing Here!!! -> Threat1: Signal SIGABRT
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Output Text
2020-01-16 09:58:27.127224+0200 wvApp2[6306:366786] -[__NSArrayM loadRequest:]: unrecognized selector sent to instance 0x600001f0c3c0
2020-01-16 09:59:21.186755+0200 wvApp2[6306:366786] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM loadRequest:]: unrecognized selector sent to instance 0x600001f0c3c0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c ___forwarding___ + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 wvApp2 0x00000001038677ea $s6wvApp214ViewControllerC11viewDidLoadyyF + 890
6 wvApp2 0x0000000103867a8b $s6wvApp214ViewControllerC11viewDidLoadyyFTo + 43
7 UIKitCore 0x00007fff47a0ef01 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
8 UIKitCore 0x00007fff47a13e5a -[UIViewController loadViewIfRequired] + 1084
9 UIKitCore 0x00007fff47a14277 -[UIViewController view] + 27
10 UIKitCore 0x00007fff480ca3cf -[UIWindow addRootViewControllerViewIfPossible] + 150
11 UIKitCore 0x00007fff480c9ac0 -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 232
12 UIKitCore 0x00007fff480cab43 -[UIWindow _setHidden:forced:] + 362
13 UIKitCore 0x00007fff480ddef1 -[UIWindow _mainQueue_makeKeyAndVisible] + 42
14 UIKitCore 0x00007fff482e9431 -[UIWindowScene _makeKeyAndVisibleIfNeeded] + 202
15 UIKitCore 0x00007fff4761d445 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1405
16 UIKitCore 0x00007fff4808f170 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1018
17 UIKitCore 0x00007fff4808f4b2 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 304
18 UIKitCore 0x00007fff47bfa7f5 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
19 FrontBoardServices 0x00007fff365d6165 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
20 FrontBoardServices 0x00007fff365fc4d8 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
21 FrontBoardServices 0x00007fff365e0c45 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
22 FrontBoardServices 0x00007fff365fc169 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
23 libdispatch.dylib 0x0000000103b91d48 _dispatch_client_callout + 8
24 libdispatch.dylib 0x0000000103b94cb9 _dispatch_block_invoke_direct + 300
25 FrontBoardServices 0x00007fff3662237e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x00007fff3662206c -[FBSSerialQueue _queue_performNextIfPossible] + 441
27 FrontBoardServices 0x00007fff3662257b -[FBSSerialQueue _performNextFromRunLoopSource] + 22
28 CoreFoundation 0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00007fff23bd439c __CFRunLoopDoSource0 + 76
30 CoreFoundation 0x00007fff23bd3bcc __CFRunLoopDoSources0 + 268
31 CoreFoundation 0x00007fff23bce87f __CFRunLoopRun + 1263
32 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
33 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
34 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
35 wvApp2 0x00000001038689bb main + 75
36 libdyld.dylib 0x00007fff5227ec25 start + 1
37 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
This is the Output text from All Output Window. I think this will help to clear out all misunderstandings on this question. This output is from the Run of the app till the exception.
Recent Issues
Showing Recent Issues
Build target wvApp2 of project wvApp2 with configuration Debug
CompileStoryboard /Users/admin/DevSource/wvApp2/wvApp2/Base.lproj/Main.storyboard (in target 'wvApp2' from project 'wvApp2')
cd /Users/admin/DevSource/wvApp2
export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
/Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --module wvApp2 --output-partial-info-plist /Users/admin/Library/Developer/Xcode/DerivedData/wvApp2-ehhbosgmbdwuucejiweipdfuqjzt/Build/Intermediates.noindex/wvApp2.build/Debug-iphonesimulator/wvApp2.build/Base.lproj/Main-SBPartialInfo.plist --auto-activate-custom-fonts --target-device iphone --target-device ipad --minimum-deployment-target 13.2 --output-format human-readable-text --compilation-directory /Users/admin/Library/Developer/Xcode/DerivedData/wvApp2-ehhbosgmbdwuucejiweipdfuqjzt/Build/Intermediates.noindex/wvApp2.build/Debug-iphonesimulator/wvApp2.build/Base.lproj /Users/admin/DevSource/wvApp2/wvApp2/Base.lproj/Main.storyboard
/* com.apple.ibtool.document.warnings */
/Users/admin/DevSource/wvApp2/wvApp2/Base.lproj/Main.storyboard:Bvy-8R-dSa: warning: UIWebView is deprecated since iOS 12.0 [7]
I don't know what I am doing wrong,
How can I solve this? Anyone answer is welcome.
First, you should better let variables start with a lowercase letter (and types with a uppercase). This is the kind-of-convetion in Swift (and Java and C++ and C and almost any other programming language except C#):
#IBOutlet var webView: WKWebView!
(change this using refactor in Xcode, to sync the storyboard/xib)
Then, don't use explicit unwrapping, better use if let:
if let url = URL(string: "www.google.com") {
let request = URLRequest(url: url)
webView.load(request)
}
To your exception: The only other thing (besides that the explicit url! unwrapping could fail) might be that the outlet webView is nil. You could also check this:
if (webView == nil) {
print ("Ooops")
}
If it's nil, check the connections from the storyboard/xib.
Make sure that you import webKit framework in your project target.
Target -> General -> Linked Framework and Libraries -> click on the + -> add the webKit.framwork
If you have done that and it's still not working please show more of the error message you are getting.
Also on a side note for naming convention you should not start class properties with uppercase.
Leading uppercase names are reserved for classes, this way you will always know if the code is referring to a class or a property. So in your case:
// #IBOutlet var WebView: WKWebView! change this to
#IBOutlet var webView: WKWebView!
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.
I am a beginner in programming, and new to Stack Overflow as well. I'm still figuring out how codes and this website work, so I'm sorry if I didn't use them correctly. (I'm not a native English speaker, but I'll do my best to explain my question as well as possible)
I'm using Xcode Version 8.1, and Swift.
I'm building an app for my school project. I've already created To-Do-List App and Countdown Timer App. So, I want to put them together in one app now.
I created a new project and inserted Tab Bar Controller. Then copied all the files I used in To-Do-List and Countdown Timer apps, and set up the storyboard.
There are no caution marks, but when I run the simulator, an error comes up and the simulator stops. The error I got is "Thread 1: signal SIGABRT" in this line in AppDelegate.swift:
class AppDelegate: UIResponder, UIApplicationDelegate {
and the message in the console is:
2017-01-06 20:32:22.207 PP Final App[61701:3259153] Unknown class PomodoroViewController in Interface Builder file.
2017-01-06 20:32:22.713 PP Final App[61701:3259153] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fd7faf075d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key lbTimer.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001100c234b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010fb2321e objc_exception_throw + 48
2 CoreFoundation 0x00000001100c2299 -[NSException raise] + 9
3 Foundation 0x000000010f63326f -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x000000011067f4ef -[UIViewController setValue:forKey:] + 88
5 UIKit 0x00000001108f379e -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000110067590 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x00000001108f2122 -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x0000000110685c21 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x0000000110686543 -[UIViewController loadView] + 177
10 UIKit 0x0000000110686878 -[UIViewController loadViewIfRequired] + 201
11 UIKit 0x00000001106870cc -[UIViewController view] + 27
12 UIKit 0x00000001106e52df -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 483
13 UIKit 0x00000001106e4721 -[UITabBarController transitionFromViewController:toViewController:] + 59
14 UIKit 0x00000001106e05e2 -[UITabBarController _setSelectedViewController:] + 365
15 UIKit 0x00000001106e0464 -[UITabBarController setSelectedViewController:] + 234
16 UIKit 0x000000011059e6e6 +[UIView(Animation) performWithoutAnimation:] + 90
17 UIKit 0x00000001106daa00 -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 354
18 UIKit 0x00000001106dbb7a -[UITabBarController viewWillAppear:] + 206
19 UIKit 0x000000011068ca0f -[UIViewController _setViewAppearState:isAnimating:] + 692
20 UIKit 0x000000011068d11f -[UIViewController __viewWillAppear:] + 147
21 UIKit 0x000000011068e913 -[UIViewController viewWillMoveToWindow:] + 507
22 UIKit 0x0000000110595151 -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 621
23 UIKit 0x00000001105a5cf0 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 451
24 UIKit 0x00000001105947a1 -[UIView(Hierarchy) addSubview:] + 838
25 UIKit 0x0000000110550f5b -[UIWindow addRootViewControllerViewIfPossible] + 849
26 UIKit 0x00000001105513a2 -[UIWindow _setHidden:forced:] + 293
27 UIKit 0x0000000110564cb5 -[UIWindow makeKeyAndVisible] + 42
28 UIKit 0x00000001104ddc89 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
29 UIKit 0x00000001104e3de9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
30 UIKit 0x00000001104e0f69 -[UIApplication workspaceDidEndTransaction:] + 188
31 FrontBoardServices 0x0000000113ed3723 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
32 FrontBoardServices 0x0000000113ed359c -[FBSSerialQueue _performNext] + 189
33 FrontBoardServices 0x0000000113ed3925 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
34 CoreFoundation 0x0000000110067311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
35 CoreFoundation 0x000000011004c59c __CFRunLoopDoSources0 + 556
36 CoreFoundation 0x000000011004ba86 __CFRunLoopRun + 918
37 CoreFoundation 0x000000011004b494 CFRunLoopRunSpecific + 420
38 UIKit 0x00000001104df7e6 -[UIApplication _run] + 434
39 UIKit 0x00000001104e5964 UIApplicationMain + 159
40 PP Final App 0x000000010f52c1cf main + 111
41 libdyld.dylib 0x000000011373c68d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
In this message, I see "Unknown class PomodoroViewController in Interface Builder file." This is the problem, right? But I don't know why I got this message. Are there any problems in the file?
Is the way I use Tab Bar Controller right?
Here's the code file of Pomodoro View Controller:
PomodoroViewController
import UIKit
class PomodoroViewController: UIViewController {
#IBOutlet weak var lbTimer: UILabel!
let pomodoroTime: TimeInterval = 60 * 25 //Pomodoro Timer 25 minutes
let formatter = DateFormatter()
var theTime: TimeInterval = 0.0
override func viewDidLoad(){
super.viewDidLoad()
formatter.dateFormat = "mm:ss"
let startTime = Date(timeIntervalSinceReferenceDate: pomodoroTime)
lbTimer.text = formatter.string(from: startTime)
}
override func didReceiveMemoryWarning(){
super.didReceiveMemoryWarning()
}
#IBAction func countDown(_ sender: UIButton) {
theTime = pomodoroTime
Timer.scheduledTimer(timeInterval: 1.0,
target: self,
selector: #selector(PomodoroViewController.tickTimer(timer:)),
userInfo: nil,
repeats: true)
}
func tickTimer(timer: Timer){
theTime -= 1.0
let newTime = Date(timeIntervalSinceReferenceDate: theTime)
if theTime < 0.1 {
timer.invalidate()
}
}
}
and this is how the storyboard looks like:
storyboard
What this error means is:
You have a storyboard (or maybe a xib) that says that one of the view controllers is a PomodoroViewController. But...
PomodoroViewController does not exist when the app is running.
The message says that iOS tried to find PomodoroViewController but it wasn't there, so it tried to use UIViewController instead. Except UIViewController doesn't have the lbTimer property, which makes the app crash.
There are a couple of reasons this could happen:
You might have forgotten to copy PomodoroViewController to the new project.
If you did copy it, you might not be including it in the app target. [Files can be included in the Xcode project that don't get compiled, because you might use the same project file for more than one target.]
In the second case, make sure that the file is checked in the file inspector on the right side of the Xcode window:
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 .
SO I'm making a simple stopwatch app via a tutorial I found online. I followed the code word for ford and created a the UI to connect to it too.
However, whenever I try to run the program it the iOS Simulator fails to get past the screen which states the name of the app. Then it produces a ton of code, and highlights this:
class AppDelegate: UIResponder, UIApplicationDelegate {`
under which it states THREAD 1: signal SIGABRT
What does that mean?
Also in the console I get this message:
(apologies in advance for the big chunk of code, tabbing it it didn't seem to work)
2015-06-15 15:53:54.313 stopwatch2[20524:1296474] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<stopwatch2.ViewController 0x7f9280476960> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key display.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010fcecc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000111857bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010fcec8a9 -[NSException raise] + 9
3 Foundation 0x000000011010ab53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010fc34d50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000011086352b -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x00000001106bb718 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x00000001106bbd08 -[UIViewController loadView] + 109
8 UIKit 0x00000001106bbf79 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x00000001106bc40e -[UIViewController view] + 27
10 UIKit 0x00000001105d72c9 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x00000001105d768f -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x00000001105e3e21 -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x0000000110587457 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
14 UIKit 0x000000011058a1de -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
15 UIKit 0x00000001105890d5 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x00000001133675e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
17 CoreFoundation 0x000000010fc2041c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010fc16165 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010fc15f25 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010fc15366 CFRunLoopRunSpecific + 470
21 UIKit 0x0000000110588b42 -[UIApplication _run] + 413
22 UIKit 0x000000011058b900 UIApplicationMain + 1282
23 stopwatch2 0x000000010faf0ff7 main + 135
24 libdyld.dylib 0x0000000111faf145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
However, this is my actual code:
import UIKit
class ViewController: UIViewController {
var timer = NSTimer()
var count = 0
func updateTime() {
count++
time.text = "\(count)"
}
#IBOutlet var time: UILabel!
#IBAction func pause(sender: AnyObject) {
timer.invalidate()
}
#IBAction func stop(sender: AnyObject) {
timer.invalidate()
count = 0
time.text = "0"
}
#IBAction func start(sender: AnyObject) {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("updateTime"),userInfo: nil, repeats: true)
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Someone please help?
You probably connected an object called display to your View Controller, but then removed/changed the property in the source code.
You have to go to your controller in the Storyboard, click the outlets icon and delete the display outlet, it will have an exclamation mark.