AWS Mobilehub: Swift 3 update, shows error at launchoptions - ios

Since I updated my amazon web services app I created with AWS Mobilehub to swift 3 I receive the following error message:
As soon as I use "!" to remove the error my app crashes due to a fatal error:

The AWS Mobile Hub console does not yet provide Swift 3 sample app code. The Swift sample app download can only be used with the legacy compiler setting in the Xcode project. We have received multiple requests for Swift 3 support, so we are working to prioritize it, but I can't provide an expected completion date at this time.

launchOptions is an optional. If no shortcut is passed in, it will be nil. Check the value before passing to AWSMobileClient like so...
if let launchOptions != nil {
return AWSMobileClient.sharedInstance.didFinishLaunching(application, withOptions: launchOptions!)
}
return false

Modify 'func didFinishLaunching' method in AWSMobileClient.swift,
if (!isInitialized) {
AWSIdentityManager.defaultIdentityManager().resumeSession(completionHandler: { (result, error) in
print("Result: \(result) \n Error:\(error)")
})
isInitialized = true
}

Related

INUIAddVoiceShortcutButton doesn't work if Shortcuts App is deleted

I had added a INUIAddVoiceShortcutButton which works fine, but when I delete the Shortcuts App it stops working. The delegates still return that the shortcut was successful, but the button doesn't change to reflect that the shortcut was added. I found that I have to re-install the Shortcuts app AND restart my phone to return function.
Is there a way to determine if the Ahortcuts app is install? Is there something missing?
I also tested this with Apple's demo Soup Chef app.
The best I've found is calling INVoiceShortcutCenter.shared.getAllVoiceShortcuts returns an error:
Optional(
Error Domain=IntentsErrorDomain
Code=7001 "Failed to get voice shortcuts"
UserInfo={
NSDebugDescription=Failed to get voice shortcuts,
NSUnderlyingError=0x283c42910
{
Error Domain=VCVoiceShortcutsErrorDomain
Code=1004
"Shortcuts app is not installed"
UserInfo={NSLocalizedFailureReason=Shortcuts app is not installed
}
}}
)
And after adding the shortcut it returns nil:
func addVoiceShortcutViewController(_ controller: INUIAddVoiceShortcutViewController, didFinishWith voiceShortcut: INVoiceShortcut?, error: Error?) {
INVoiceShortcutCenter.shared.getVoiceShortcut(with: voiceShortcut!.identifier) { (shortcut, error) in
print("\(String(describing: shortcut))") // nil
print("\(error.debugDescription)") // nil
}
}

configure firebase with options is crashing in Xcode 11 and Firebase 6.19

I'm trying to register a second firebase application in my app. The first one is correctly registered inside didFinishWithLaunchingWithOptions method (by default is using the GoogleService-Info.plist)
FirebaseApp.configure()
Then I need to retrieve a new googleAppId from a server and configure a new application using this new googleAppId and using my iOSID of curse. I am doing all this registration inside AppDelegate. I'm registering this way:
let options = FirebaseOptions(googleAppID: String(format: "1:%a:ios:%a", googleID, iOSID), gcmSenderID: googleID)
//Deleting the first app in order to register the second
let app = FirebaseApp.app()
app?.delete { _ in }
FirebaseApp.configure(options: options)
It was working well until I update my firebase version from 6.2 to 6.19, now the app is crashing in FirebaseApp.configure(options: options)
The log says:
Terminating app due to uncaught exception 'com.firebase.installations', reason
'[Firebase/Installations][I-FIS008000] Could not confiure Firebase Installations die to invalid
Firebase options. The following parameters are nil or empty: `FirebaseOptions.APIKEY`. If you
use GoogleServices-Info.plist please download the most recent version from the Firebase Console.
If you configure Firebase in code, please make sure you specify all required paramaters.
Is worth mencioning that a new Framework was added to Analytics in Firebase version 6.15 so I had to added it in order to make my app compile again.
I also tried to add a new parameter inside the FirebaseOptions but is still asking for the same parameters, it is not expecting an APIKEY which i don't know where to get it
The message comes from here as far as I can see. The check done there shows that these three values must always be specified:
if (appName.length < 1) {
[missingFields addObject:#"`FirebaseApp.name`"];
}
if (appOptions.APIKey.length < 1) {
[missingFields addObject:#"`FirebaseOptions.APIKey`"];
}
if (appOptions.googleAppID.length < 1) {
[missingFields addObject:#"`FirebaseOptions.googleAppID`"];
}
From the error message and your code it looks like you're not specifying the APIKEY in your FirebaseOptions, which is required according to the SDK.

iOS: GooglePlaces API error

I am getting this error when trying to use the sample code from Google Places getting started Link
Error: Current Place error: The operation couldn’t be completed. An internal error occurred in the Places API library.
I am calling this function on viewDidLoad. I also created a IBAction with this code to make sure it wasn't a timing issue. I got the same error this way as well.
placesClient.currentPlace { (placeLikelihoods, error) in
guard error == nil else {
print("Current Place error: \(error!.localizedDescription)")
return
}
if let placeLikelihoods = placeLikelihoods {
for likelihood in placeLikelihoods.likelihoods {
let place = likelihood.place
print(place.name)
}
}
}
I have created a new project in Firebase, which created a new project in Google Dev Console. I created new API Key, Enabled Google Maps and Google Places API. I added CoreLocation framework, my pods are up to date. I should not be hitting any limits as it is just me learning. I have the Location When In Use set up i the Plist - user gets the dialog on fresh install. I accepted it. I added location manager code from here to make sure I am getting the location. I signed up for Apple developer to get the app on my device just in case the location wasn't staying on the simulator. I have a feeling this is something stupid. Please let me know any ideas to get passed this. Thanks!

Parse - callFunctionInBackground crashes app on [__NSTaggedDate UTF8String] - But did not when I submitted my app

I'm using a Parse Cloud function to get a list of movies. This was all working very well till today. The app crashes and I can't seem to fix it.
Weird (and highly problematic) thing is that it did work yesterday and the days before. (This app is in production in the App store)
This is the function causing the error:
PFCloud.callFunctionInBackground(function, withParameters: parameters) { (movies, error) -> Void in
if error != nil { return block(success: false, movies: []) }
PFObject.pinAllInBackground(movies as! [PFObject])
let foundMovies = ParseMovie.arrayFromPFObjects(movies as! [PFObject])
return block(success: true, movies: foundMovies)
}
If I comment the 4 lines inside the block, it still crashes. If I comment the entire function, it doesn't. So it seems as soon as I call "PFCloud.callFunction" the app crashes.
Any idea what can go wrong? The Parse cloud function does work, because calling it with the parse rest API gives me the movies as expected.
Any help is appreciated, thanks!
Ok, got it. Apparently I'm using an old version of the Parse SDK (1.5) and since today, this version is not working anymore.. I'm not using pods so I was not aware of this out-dated version. A bit disappointed, but probably my fault?

Google Places Callback not being called in Swift iOS

I am using the GoogleMaps SDK (maps & places). For some reason the following callback is not being called. I have put loggers in there but nothing happens.
var placesClient : GMSPlacesClient?
...
func run(){
self.placesClient?.currentPlaceWithCallback({ (list: GMSPlaceLikelihoodList?, error: NSError?) -> Void in
if let error = error {
println("error: \(error.description)")
return
}
if let list = list {
self.renderList(list)
}
})
}
For some reason the block in currentPlaceWithCallback does not get called. Yesterday it happened because my API had a wrong bundle identifier, after changing which it started working. But today it stopped.
Any idea why this would happen ? Also, are we exposed to any API logs by Google ?
I was getting the same issue on my iPhone 6 device AND iPhone 6 simulator.
The fix was to add the NSLocationWhenInUseUsageDescription permission in Info.plist! But, it worked only on my iPhone 6 device, NOT the simulator.
As mentioned in the Google Place Guide:
(https://developers.google.com/places/ios-api/start)
Please note, as this sample requires access to the location of the device to get the current location, you will need to set the NSLocationWhenInUseUsageDescription key with appropriate explanatory text in your project's Info.plist file. For more details, see the guide to getting current place.
Now, the way I got it working on the iPhone simulator was by changing my location on the Simulator: Debug -> Location. That is, it was set to 'Apple' by default, I just changed it to Bicycle Ride.
It worked for me, may not for all.

Resources