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
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 am trying to follow the steps to connect Firebase to an iOS App generated by Flutter.
In the final step, when adding the line FirebaseApp.configure() into the AppDelegate.swift file, the App builds OK, but then crashes upon execution, indicating a Signal Abortion on Thread 1...
Thread 1: signal SIGABRT
The code in AppDelegate.swift is the following:
import UIKit
import Flutter
import Firebase
#UIApplicationMain
#objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
FirebaseApp.configure()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
};
}
The full Error log provided by Xcode is the following:
2019-11-18 07:11:34.664822-0500 Runner[82048:876634] - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2019-11-18 07:11:34.849351-0500 Runner[82048:876630] 6.13.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2019-11-18 07:11:34.860414-0500 Runner[82048:876433] *** Terminating app due to uncaught exception 'com.firebase.core', reason: '`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c4f02e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50b97b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c4ee6c +[NSException raise:format:] + 188
3 Runner 0x00000001040bf51a +[FIRApp configure] + 138
4 Runner 0x00000001040baea4 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 212
5 Runner 0x00000001040bb1f4 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 212
6 UIKitCore 0x00007fff47846788 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 232
7 UIKitCore 0x00007fff47848197 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3980
8 UIKitCore 0x00007fff4784dce6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1281
9 UIKitCore 0x00007fff46f843c9 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
10 UIKitCore 0x00007fff47471be1 _UIScenePerformActionsWithLifecycleActionMask + 83
11 UIKitCore 0x00007fff46f84edb __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
12 UIKitCore 0x00007fff46f848ea -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 296
13 UIKitCore 0x00007fff46f84d08 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 818
14 UIKitCore 0x00007fff46f8459d -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
15 UIKitCore 0x00007fff46f88bcb __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 178
16 UIKitCore 0x00007fff4739769b +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 865
17 UIKitCore 0x00007fff4749051f _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
18 UIKitCore 0x00007fff46f888e6 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153
19 UIKitCore 0x00007fff47490422 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
20 UIKitCore 0x00007fff46f88754 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381
21 UIKitCore 0x00007fff46ddf123 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
22 UIKitCore 0x00007fff46dddca8 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248
23 UIKitCore 0x00007fff46ddee4d -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
24 UIKitCore 0x00007fff4784c343 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 535
25 UIKitCore 0x00007fff473b920d -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
26 FrontBoardServices 0x00007fff36555225 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
27 FrontBoardServices 0x00007fff3657b598 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
28 FrontBoardServices 0x00007fff3655fd05 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
29 FrontBoardServices 0x00007fff3657b229 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
30 libdispatch.dylib 0x00000001070ebd48 _dispatch_client_callout + 8
31 libdispatch.dylib 0x00000001070eecb9 _dispatch_block_invoke_direct + 300
32 FrontBoardServices 0x00007fff365a143e __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
33 FrontBoardServices 0x00007fff365a112c -[FBSSerialQueue _queue_performNextIfPossible] + 441
34 FrontBoardServices 0x00007fff365a163b -[FBSSerialQueue _performNextFromRunLoopSource] + 22
35 CoreFoundation 0x00007fff23bb2221 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
36 CoreFoundation 0x00007fff23bb214c __CFRunLoopDoSource0 + 76
37 CoreFoundation 0x00007fff23bb1924 __CFRunLoopDoSources0 + 180
38 CoreFoundation 0x00007fff23bac62f __CFRunLoopRun + 1263
39 CoreFoundation 0x00007fff23babe16 CFRunLoopRunSpecific + 438
40 GraphicsServices 0x00007fff38438bb0 GSEventRunModal + 65
41 UIKitCore 0x00007fff4784fb48 UIApplicationMain + 1621
42 Runner 0x00000001040bb45b main + 75
43 libdyld.dylib 0x00007fff51a1dc25 start + 1
44 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
A very interesting line in the above Error log:
Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure]; (FirebaseApp.configure() in Swift) could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.'
So...
That message clearly suggests that there may be some issue with the GoogleService-Info.plist, like if it wasn't present... except that it IS indeed present, freshly downloaded from Firebase, it is located in the correct folder, and I have thoroughly reviewed the contents of the plist to verify the Bundle ID, Team ID and all other info is correct...
May anyone kindly please offer some suggestion to solve this problem?
THANKS
To check that you have included the file in your target do the following
Click on the file that you are checking
Click on the file inspector
Check that the file is included in your required target. Most apps only have one target.
When I attempted to add the FirebaseApp.configure() statement to my AppDelegate.swift file, the project would no longer build. So I removed those statements and continued on with the Firebase/Analytics setup. My app was able to eventually communicate with the Firebase server without that statement. It looks like the firebase plugins must be doing that for us. I added both firebase_core and firebase_analytics to my pubspec.yaml as:
firebase_core: ^0.4.0+9
firebase_analytics:
I have a Firebase integrated to my swift app. All the initialisation done is programmatically and the FirebaseApp.config() is called the very first thing in didLaunchWithOptions in the AppDelegate.
But for some random reason, whenever the app is in the background for a long time, the app just crashes on the run, i.e making it's state active.
Interestingly, this crash happens exactly 2 times in the following flow:
1. The App is idle in background
2. You bring it to the active mode(You just tap the icon to open the app. All this while the app isn't killed)
3. Tap 1 ---- The App Crashes----
4. Tap 2 ---- The App Crashes----
5. Tap 3 ---- The App Runs Normally ----
I tried to troubleshoot but all my efforts have gone in vain. I have tried setting up both the storyboards and programmatically launching app. Nothing works.
Following is the stack trace :
SpotMi-Dev[74741:2958059] *** Terminating app due to uncaught exception 'FIRAppNotConfigured', reason: 'Failed to get default Firebase Database instance. Must call `[FIRApp configure]` (`FirebaseApp.configure()` in Swift) before using Firebase Database.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d3816fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010c14aac5 objc_exception_throw + 48
2 CoreFoundation 0x000000010d381555 +[NSException raise:format:] + 197
3 SpotMi-Dev 0x0000000101be5ba1 +[FIRDatabase database] + 97
4 SpotMi-Dev 0x0000000101aaba6b $s10SpotMi_Dev13FBDataserviceCACycfc + 59
5 SpotMi-Dev 0x0000000101aac193 $s10SpotMi_Dev13FBDataserviceCACycfcTo + 19
6 SpotMi-Dev 0x0000000101aa696c $s10SpotMi_Dev13FBDataserviceCACycfC + 44
7 SpotMi-Dev 0x0000000101aa692c globalinit_33_8263DB418F9D5BC81149F56895386F46_func0 + 28
8 libdispatch.dylib 0x000000010ecaddb5 _dispatch_client_callout + 8
9 libdispatch.dylib 0x000000010ecaf83d _dispatch_once_callout + 66
10 libswiftCore.dylib 0x000000010e2c6579 swift_once + 25
11 SpotMi-Dev 0x0000000101aa69f4 $s10SpotMi_Dev13FBDataserviceC2dsACvau + 36
12 SpotMi-Dev 0x000000010180b013 $s10SpotMi_Dev9ProfileVCC18initializeUserPostyyF + 179
13 SpotMi-Dev 0x0000000101809278 $s10SpotMi_Dev9ProfileVCC11viewDidLoadyyF + 616
14 SpotMi-Dev 0x00000001018095b4 $s10SpotMi_Dev9ProfileVCC11viewDidLoadyyFTo + 36
15 UIKitCore 0x000000011589443b -[UIViewController loadViewIfRequired] + 1183
16 UIKitCore 0x0000000115894868 -[UIViewController view] + 27
17 UIKitCore 0x0000000115ebd4ad -[UIApplication(StateRestoration) _restoreApplicationPreservationStateWithSessionIdentifier:beginHandler:completionHandler:] + 6413
18 UIKitCore 0x0000000115eb8fdc -[UIApplication(StateRestoration) _doRestorationIfNecessary] + 211
19 UIKitCore 0x0000000115e8e2c9 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 208
20 UIKitCore 0x0000000115e8fcad -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3932
21 UIKitCore 0x0000000115e950c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
22 UIKitCore 0x00000001156da6d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
23 UIKitCore 0x00000001156e2fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
24 UIKitCore 0x00000001156da2ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
25 UIKitCore 0x00000001156dac48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
26 UIKitCore 0x00000001156d8fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
27 UIKitCore 0x00000001156d8c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
28 UIKitCore 0x00000001156dd9b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
29 UIKitCore 0x00000001156de610 _performActionsWithDelayForTransitionContext + 100
30 UIKitCore 0x00000001156dd71d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
31 UIKitCore 0x00000001156e26d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
32 UIKitCore 0x0000000115e939a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
33 UIKitCore 0x0000000115a4adfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
34 FrontBoardServices 0x00000001133a4125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
35 FrontBoardServices 0x00000001133aded6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
36 FrontBoardServices 0x00000001133ad700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
37 libdispatch.dylib 0x000000010ecaddb5 _dispatch_client_callout + 8
38 libdispatch.dylib 0x000000010ecb12ba _dispatch_block_invoke_direct + 300
39 FrontBoardServices 0x00000001133df146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
40 FrontBoardServices 0x00000001133dedfe -[FBSSerialQueue _performNext] + 451
41 FrontBoardServices 0x00000001133df393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
42 CoreFoundation 0x000000010d2e8be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
43 CoreFoundation 0x000000010d2e8463 __CFRunLoopDoSources0 + 243
44 CoreFoundation 0x000000010d2e2b1f __CFRunLoopRun + 1231
45 CoreFoundation 0x000000010d2e2302 CFRunLoopRunSpecific + 626
46 GraphicsServices 0x000000011034e2fe GSEventRunModal + 65
47 UIKitCore 0x0000000115e96ba2 UIApplicationMain + 140
48 SpotMi-Dev 0x000000010174287b main + 75
49 libdyld.dylib 0x000000010ed22541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Following is the code from didLaunchWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
#if DEVELOPMENT
print("Development Mode Started")
#else
print("Production Mode Started")
#endif
FirebaseApp.configure()
Messaging.messaging().delegate = self
//other app functions
return true
}
I am calling the Firebase API in the viewDidLoad of init controller. And this is the Service through which it gets called and this even contains the crash aswell.
class FBDataservice : NSObject {
static var ds = FBDataservice() //<------ Creates Error here on every single crash related to this issue
let DB_URL: DatabaseReference = Database.database().reference()
let ST_URL: StorageReference = Storage.storage().reference()
private lazy var _REF_BASE = DB_URL
}
And then I just call FBDataservice.ds._REF_BASE.child("something").observe( .Event, with (Datasnapshot)) in the viewDidLoad or viewDidAppear. I am just mostly fetching the data. And then push data like updating app RunCounts on didBecameActive in AppDelegate
Any help will immensely be appreciated. Cheers
Check FirebaseApp.app() if this is nil can you call the FirebaseApp.configure() again? You need to debug if this crashes in appDidBecomeActive: or didEneterInForeground: method.
Also please check where you use FirebaseDatabase at very first time after launching the application except the configuration line? I mean is in any ViewController or anywhere, we need to check the condition here.
Updated Question:
Regarding your updated question FBDataservice() where are you making its instance because as you create its instance it will create DB_URL and ST_URL url instances which are related to Firebase so probably Firebase is not configured before this. You can override its init method to check if Firebase is configured or not.
You took two variables which will be create in constructor whenever you will make an instance of this class.
Try one thing... replace
static var ds = FBDataservice()
with
static var ds: FBDataservice {
if FirebaseApp.app() == nil {
FirebaseApp.configure()
}
return FBDataservice()
}
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 .
I am currently using 1.6.1 via CocoaPods (= latest)
In my swift project I enable the localdatastore and then set the parse application id.
After that, I load a storyboard which is a PFQueryTableViewController subclass.
Really nothing special there. But it still crashes.
It seems to crash in Parse internally on [PFQuery setCachePolicy:]
What could be wrong? How do I make offline functionality working?
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Method not allowed when Pinning is enabled.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001078a0f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000107ea3bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001078a0e6d +[NSException raise:format:] + 205
3 NMC-Goes 0x00000001044abe44 -[PFQuery setCachePolicy:] + 35
4 NMC-Goes 0x00000001043f6e85 -[PFQueryTableViewController queryForTable] + 341
5 NMC-Goes 0x00000001043f712e -[PFQueryTableViewController loadObjects:clear:] + 110
6 NMC-Goes 0x00000001043f70ba -[PFQueryTableViewController loadObjects] + 58
7 NMC-Goes 0x00000001043f69f9 -[PFQueryTableViewController viewDidLoad] + 73
8 NMC-Goes 0x000000010425ae1a _TFC8NMC_Goes23TripTableViewController11viewDidLoadfS0_FT_T_ + 74
9 NMC-Goes 0x000000010425bca2 _TToFC8NMC_Goes23TripTableViewController11viewDidLoadfS0_FT_T_ + 34
10 UIKit 0x00000001063f3a90 -[UIViewController loadViewIfRequired] + 738
11 UIKit 0x000000010642206b -[UINavigationController _layoutViewController:] + 44
12 UIKit 0x00000001064225b5 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 216
13 UIKit 0x00000001064226b4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
14 UIKit 0x0000000106423487 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
15 UIKit 0x0000000106423f47 -[UINavigationController __viewWillLayoutSubviews] + 43
16 UIKit 0x0000000106569509 -[UILayoutContainerView layoutSubviews] + 202
17 UIKit 0x0000000106347973 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
18 QuartzCore 0x0000000105fdbde8 -[CALayer layoutSublayers] + 150
19 QuartzCore 0x0000000105fd0a0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
20 QuartzCore 0x0000000105fd087e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
21 QuartzCore 0x0000000105f3e63e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
22 QuartzCore 0x0000000105f3f74a _ZN2CA11Transaction6commitEv + 390
23 UIKit 0x00000001062cc54d -[UIApplication _reportMainSceneUpdateFinished:] + 44
24 UIKit 0x00000001062cd238 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2642
25 UIKit 0x00000001062cbbf2 -[UIApplication workspaceDidEndTransaction:] + 179
26 FrontBoardServices 0x000000010b6a12a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
27 CoreFoundation 0x00000001077d653c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
28 CoreFoundation 0x00000001077cc285 __CFRunLoopDoBlocks + 341
29 CoreFoundation 0x00000001077cc045 __CFRunLoopRun + 2389
30 CoreFoundation 0x00000001077cb486 CFRunLoopRunSpecific + 470
31 UIKit 0x00000001062cb669 -[UIApplication _run] + 413
32 UIKit 0x00000001062ce420 UIApplicationMain + 1282
33 NMC-Goes 0x000000010427840e top_level_code + 78
34 NMC-Goes 0x00000001042784ea main + 42
35 libdyld.dylib 0x000000010877a145 start + 1
36 ??? 0x0000000000000001 0x0 + 1
)
You cannot use the old query caching policies when pinning is enabled.
See here:
PFQuery Class Reference - cachePolicy
I've made an example project to demo the problem to Parse.com (see the bug: https://developers.facebook.com/bugs/1544122569192939/).
The response that I got from Parse was that the ParseUI framework from cocoapods is known to have this problem.
They suggested I get ParseUI from https://parse.com/docs/downloads
I'll try and see if that fixes the problem with my PFQueryTableViewController
Edit: I've added the framework manually and took it out of the Podfile. The crash now no longer occurs. So the bug is in the ParseUI cocoapod like parse told me on developers.facebook.com
I also faced the same problem. I commented below line from classes which extends PFQueryTableViewController & it worked for me.
if ([self.objects count] == 0) {
query.cachePolicy = kPFCachePolicyCacheThenNetworkd;
}
I had got the exact stack trace thrown when I was trying out Parse. But then figured out that I had included this line of code in my app delegate.
Objective-C
[Parse enableLocalDatastore];
I removed this code and it worked like a charm.
Swift
Remove:
Parse.enableLocalDatastore()
//
// AppDelegate.swift
import UIKit
import Parse
import Bolts
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
Parse.enableLocalDatastore()
Parse.setApplicationId("#######", clientKey: "#####")
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
return true
}
setApplicationID inside App Delegate instead of Controller solves the problem for me.
you can try this code in swift.
if [self.objects].count == 0 {
query?.cachePolicy = PFCachePolicy.CacheThenNetwork
}
I added 'import Bolts' below:
import UIKit
import Parse
As shown in the screen shot.
This fixed the issue for me.