iOS Dropbox Datastore API: WebKit Exception + Unsupported URL - dropbox-api

(Note, this seems related to this question, but is with a different flavor of the Dropbox SDK.)
Using the latest version of the Dropbox Datastore API on iOS, I am getting an exception after performing these steps:
Successfully connect my app to Dropbox
Disconnect my app from Dropbox.
Reconnect app to same, or another, Dropbox account.
Then this happens:
The console in Xcode shows this:
*** WebKit discarded an uncaught exception in the webView:
decidePolicyForNavigationAction:request:frame:decisionListener:
delegate: <NSInvalidArgumentException> -[PilotPro.SettingsTableViewController
dropboxWasLinked:]: unrecognized selector sent to instance 0x7fc489cb94d0
And then this:
[WARNING] DropboxSDK: error loading DBConnectController - Error
Domain=NSURLErrorDomain Code=-1002 "unsupported URL"
UserInfo=0x7fc48c11bc50 {NSUnderlyingError=0x7fc48c4418c0 "unsupported URL",
NSErrorFailingURLStringKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSErrorFailingURLKey=db-***://1/connect?
oauth_token_secret=***&state=***&oauth_token=***&uid=***,
NSLocalizedDescription=unsupported URL}
I suspect I am not doing enough to disconnect Dropbox from my account, so it's conflicting with a Dropbox session somehow. Here's what I'm doing to disconnect:
//===::: Disable Dropbox :::===
DBAccountManager.sharedManager().linkedAccount.unlink()
// Shutdown and stop listening for changes to the datastores
DBDatastoreManager.sharedManager().shutDown()
DBDatastoreManager.sharedManager().removeObserver(self)
//Migrate back to local datastores
DBDatastoreManager.setSharedManager(DBDatastoreManager.localManagerForAccountManager(DBAccountManager.sharedManager()))
Any ideas? Thanks in advance.

It turns out that the errors given by Xcode were a bit of a red herring in this case. I was firing an NSNotification after Dropbox finished authenticating, and in doing so I was using this:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "dropboxWasLinked:", name: "dropboxLinked", object: nil)
...but my dropboxWasLinked method wasn't set up to receive any arguments:
func dropboxWasLinked(){ ... }
So Xcode was firing an exception that messed up the authentication and made other things appear to be the cause, when in reality all I needed to do was remove the : from my selector in the NSNotification listener.
Ah, the joys of programming. :)

Related

Where to place firebase-messaging-sw.js file in Play framework project?

I am using FCM to send a notification to the browser. I get the following error:
messaging/failed-serviceworker-registration", message: "Messaging: We
are unable to register the default s…t. (messaging/failed-serviceworker-
registration).", browserErrorMessage: "Failed to register a
ServiceWorker: A bad HTTP res…code (404) was received when fetching the
script.", stack: "FirebaseError: Messaging: We are unable to
registe…/assets/javascripts/firebase/firebase.js:1:760104
What I understand from my google research is that the firebase-messaging-sw.js is not in the root directory, I'am placing it under public/javascripts/. I'am using play framework for this project. My project hiearchy:
|app(controllers, views)
|public
|conf

AppleMusicKit SDK / Sample Project - UserToken issue

I'm currently experimenting with the Adding-Content-to-Apple-Music code found here: https://developer.apple.com/musickit/
I'm using:
XCode 9 beta 2,
iOS 11 (iPhone 5s)
I have a developer token (which works when I query the Apple Music API searching songs etc...) but I now want to use this to exchange for a User Token so I can perform write actions against my Apple Music account.
The test app fires up and allows me to request authentication. From this I can see:
MPMedia Library - Authorized
SKCloudServicesController - Authorized
Capabilities:
Add to Cloud Music Library
Music Catalog Playback
My next obvious step is to use the developer token to gain the user token. However, as soon as I call the following:
cloudServiceController.requestUserToken(forDeveloperToken: developerToken, completionHandler: completionHandler)
i see the following error in the completionHandler - can anyone help?
2017-07-14 10:05:39.179300+0100 Adding-Content-to-Apple-Music[1326:172100] [MC] Reading from public effective user settings.
2017-07-14 10:05:40.635503+0100 Adding-Content-to-Apple-Music[1326:172299] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2017-07-14 10:05:40.636449+0100 Adding-Content-to-Apple-Music[1326:172100] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
2017-07-14 10:05:40.800933+0100 Adding-Content-to-Apple-Music[1326:172297] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2017-07-14 10:05:40.801259+0100 Adding-Content-to-Apple-Music[1326:172299] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
An error occurred when requesting user token: The operation couldn’t be completed. (SKErrorDomain error 1.)
In Settings > iTunes & App Store on my device I am logged in with my Apple ID. Same goes for Apple Music too.
Update on this:
I also posted about this over on the Apple dev forums. It was an error on their side and now appears to be fixed. I can get a UserToken in both iOS 10 and 11 now.

Facebook iOS 10 login error :user not allowed to see application

I am new to iOS programming and I made an app that was able to connect to Facebook before without any problem. I've enabled keychain sharing and made the app public but last week I started seeing an error message:
2017-05-23 17:26:11.130 test[3231:77099] -canOpenURL: failed for URL:
"fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus
error -10814.)"
I've followed all the login steps, but no success.
Any help will be greatly appreciated.

Android mobile first app stopped working after Bluemix moved to cflinuxfs2 stack

I have an android app based on the bluelist app for bluemix BMS service. it stopped working yesterday when the stack is moved to cflinuxfs2.
Today I checked my ios app on the same bluemix service, it is working. so I looked into the exception on Android, it is from MFPush, looks like a context is null. see the attached image for the line of code where the NPE is thrown.
The stacktrace is: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)' on a null object reference
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at com.ibm.mobilefirstplatform.clientsdk.android.push.api.MFPPush.listen(MFPPush.java:232)
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at com.ibm.bluelist.GroupsActivity.onResume(GroupsActivity.java:250)
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1257)
12-10 16:00:31.240 14482-14482/com.ibm.bluelist E/AndroidRuntime: at android.app.Activity.performResume(Activity.java:6119)
Chances are the MFPPush SDK has not been initialized when you are attempting to call:
push.listen(notificationListener)
I suggest saving the push value:
push = MFPPush.getInstance()
Immediately after initialization or registration (whatever you feel is more appropriate) in the class.
That way you will have the appropriate initialized push instance when attempting to listen to a notification listener.

trying to use [pffacebookUtils logininbackgrounwithreadpermission], but get error about fbinternalutility validatescheme

I'm using
[PFFacebookUtils loginInbackgroundWithReadPermission ...
to log in my user.
However, I received this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FBSDKInternalUtility validateURLSchemes]: unrecognized selector sent to class 0x10b695e40'
I have looked through all the header files; but I just cannot find a class named as FBSDKInternalUtility. Before the upgrade of Parse 1.7.2 and Facebook SDK v4, my log in system works perfectly.
Please help.
It seems like you haven't added FBSDKCoreKit.framework to your project. Add the framework and make sure that you add #import <FBSDKCoreKit/FBSDKCoreKit.h> to your file.