CSStickyHeaderFlowLayout swift receiver has no segue with identifier - ios

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 .

Related

Need help on XCode: Thread 1:EXC_BAD_INSTRUCTION (WebView)

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!

How to move from one viewcontroller to another in a storyboard using swift [duplicate]

This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 4 years ago.
I am trying to move from SignInViewController to RegisterUserViewController on button click .Here is code
#IBAction func RegisterNewAccountButtonTapped(_ sender: Any) {
print("Register account button tapped")
//RegisterUserViewController
// let storyboard = UIStoryboard(name: "SignInViewController", bundle: nil)
let vc = self.storyboard?.instantiateViewController(withIdentifier: "RegisterUserViewController") as! RegisterUserViewController
self.present(vc, animated: true)
}
Here in this picture are the class and storyboard id
Here is error that is coming on pressing Register New Account button .
2018-04-27 06:09:24.720143-0700 UserRegistrationExample[10193:1788611] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UserRegistrationExample.RegisterUserViewController 0x7f84b4f171b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key repeatPasswordTextField.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010db1826b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a1fbf41 objc_exception_throw + 48
2 CoreFoundation 0x000000010db181b9 -[NSException raise] + 9
3 Foundation 0x0000000109c20883 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 292
4 UIKit 0x000000010a95dd56 -[UIViewController setValue:forKey:] + 87
5 UIKit 0x000000010ac3ac94 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010dabb61d -[NSArray makeObjectsPerformSelector:] + 317
7 UIKit 0x000000010ac3964a -[UINib instantiateWithOwner:options:] + 1856
8 UIKit 0x000000010a964d49 -[UIViewController _loadViewFromNibNamed:bundle:] + 383
9 UIKit 0x000000010a965652 -[UIViewController loadView] + 177
10 UIKit 0x000000010a965983 -[UIViewController loadViewIfRequired] + 195
11 UIKit 0x000000010a9661e0 -[UIViewController view] + 27
12 UIKit 0x000000010b3bd39d -[_UIFullscreenPresentationController _setPresentedViewController:] + 89
13 UIKit 0x000000010a936a8f -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
14 UIKit 0x000000010a979338 -[UIViewController _presentViewController:withAnimationController:completion:] + 3808
15 UIKit 0x000000010a97c14a __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 134
16 UIKit 0x000000010a97c5ea -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
17 UIKit 0x000000010a97c086 -[UIViewController presentViewController:animated:completion:] + 181
18 UserRegistrationExample 0x00000001098e0ae5 _T023UserRegistrationExample20SignInViewControllerC30RegisterNewAccountButtonTappedyypF + 1077
19 UserRegistrationExample 0x00000001098e0c58 _T023UserRegistrationExample20SignInViewControllerC30RegisterNewAccountButtonTappedyypFTo + 72
20 UIKit 0x000000010a7cd631 -[UIApplication sendAction:to:from:forEvent:] + 83
21 UIKit 0x000000010a942000 -[UIControl sendAction:to:forEvent:] + 67
22 UIKit 0x000000010a94231d -[UIControl _sendActionsForEvents:withEvent:] + 450
23 UIKit 0x000000010a94124a -[UIControl touchesEnded:withEvent:] + 618
24 UIKit 0x000000010a840bf1 -[UIWindow _sendTouchesForEvent:] + 2807
25 UIKit 0x000000010a842314 -[UIWindow sendEvent:] + 4124
26 UIKit 0x000000010a7e82da -[UIApplication sendEvent:] + 352
27 UIKit 0x000000010b0f6f18 __dispatchPreprocessedEventFromEventQueue + 2809
28 UIKit 0x000000010b0f9a7f __handleEventQueueInternal + 5957
29 CoreFoundation 0x000000010dabb351 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 CoreFoundation 0x000000010db5ad71 __CFRunLoopDoSource0 + 81
31 CoreFoundation 0x000000010da9fcb9 __CFRunLoopDoSources0 + 185
32 CoreFoundation 0x000000010da9f29f __CFRunLoopRun + 1279
33 CoreFoundation 0x000000010da9eb29 CFRunLoopRunSpecific + 409
34 GraphicsServices 0x00000001101af9c6 GSEventRunModal + 62
35 UIKit 0x000000010a7cb9a4 UIApplicationMain + 159
36 UserRegistrationExample 0x00000001098deee7 main + 55
37 libdyld.dylib 0x000000010ec3a621 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I have visited the following links but non of them solved the problem
https://coderwall.com/p/cjuzng/swift-instantiate-a-view-controller-using-its-storyboard-name-in-xcode
instantiateViewControllerWithIdentifier - Storyboard id set but still not working
Present View Controller in Storyboard with a Navigation Controller - Swift
Swift 3, Xcode 8 Instantiate View Controller is not working
Instantiate and Present a viewController in Swift
How to remove this error.
You can download the code from this link
.https://drive.google.com/open?id=1yUaKeI6ZQphN7CsoiaeF2p4TmW_B5-9u
Try CTRL and drag from your button to the next ViewController. Then select "show". This is how you set a segue. Then click on the segue and give him an identifier. Then you need to set the
performSegue(withIdentifier: String, sender: self)
Have you tried this?

libc++abi.dylib: terminating with uncaught exception of type NSException - Do I need to fix the Launch Screen or Viewcontroller?

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.

How to run app without storyboard?

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.

iOS swift and Parse: localDataStore

I'm trying to use parse (iOS sdk v1.6.0 ) with is with switch and following the documentation I made:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Parse.enableLocalDatastore()
Parse.setApplicationId("appKey", clientKey:"clientKey")
but Launching the app I have this error:
2014-12-11 20:29:41.627 ShareTales[62985:626799] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You have to call setApplicationId:clientKey: on Parse to configure Parse.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000104873f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104163bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000104873e6d +[NSException raise:format:] + 205
3 ShareTales 0x00000001027ce7ba +[Parse getApplicationId] + 53
4 ShareTales 0x00000001027b3140 +[PFInternalUtils dataFilePath:] + 53
5 ShareTales 0x00000001027515ff -[PFSQLiteDatabase initWithName:] + 200
6 ShareTales 0x00000001027517b4 +[PFSQLiteDatabase databaseWithName:] + 69
7 ShareTales 0x0000000102766e79 +[PFOfflineStore _initializeTables] + 58
8 libdispatch.dylib 0x00000001064a07f4 _dispatch_client_callout + 8
9 libdispatch.dylib 0x000000010648d343 dispatch_once_f + 565
10 ShareTales 0x000000010275d6ef +[PFOfflineStore enableOfflineStore] + 252
11 ShareTales 0x00000001026f4c0d _TFC10ShareTales11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 157
12 ShareTales 0x00000001026f5d30 _TToFC10ShareTales11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb + 560
13 UIKit 0x0000000104c5b475 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 234
14 UIKit 0x0000000104c5bfbc -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2463
15 UIKit 0x0000000104c5ed2c -[UIApplication _runWithMainScene:transitionContext:completion:] + 1350
16 UIKit 0x0000000104c5dbf2 -[UIApplication workspaceDidEndTransaction:] + 179
17 FrontBoardServices 0x000000010c5602a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
18 CoreFoundation 0x00000001047a953c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
19 CoreFoundation 0x000000010479f285 __CFRunLoopDoBlocks + 341
20 CoreFoundation 0x000000010479f045 __CFRunLoopRun + 2389
21 CoreFoundation 0x000000010479e486 CFRunLoopRunSpecific + 470
22 UIKit 0x0000000104c5d669 -[UIApplication _run] + 413
23 UIKit 0x0000000104c60420 UIApplicationMain + 1282
24 ShareTales 0x00000001026f8d8e top_level_code + 78
25 ShareTales 0x00000001026f8dca main + 42
26 libdyld.dylib 0x00000001064d5145 start + 1
Any suggestion?
I tried also to move it after the Parse.setApplicationId
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Parse.enableLocalDatastore()
Parse.setApplicationId("appKey", clientKey:"clientKey")
and I have:
2014-12-11 20:38:28.118 ShareTales[67520:637437] Warning: A long-running operation is being executed on the main thread.
Break on warnBlockingOperationOnMainThread() to debug.
I put the [Parse enableLocalDatastore]; after the [Parse setApplicationId:clientKey:]; and i got another errors. But this another errors was because you can't use Local Datastore and Cache Policy together. When i removed the Cache Policy's methods everything works fine. So, i don't know if this is a documentation mistake, but you have to put this code after.
This error is sometimes caused by an incompatible linker flag in the iOS project templates.
To clear the error, go to your project's build settings in Xcode, and modify your "Other Linker Flags" setting:
1.) Remove "-weak_library /usr/lib/libSystem.B.dylib"
2.) Add "-weak-lSystem"
With reference to: https://www.parse.com/questions/im-getting-an-exc_bad_access-when-trying-to-call-parse-setapplicationidclientkey-what-should-i-do

Resources