NSTimeZone.localTimeZone().secondsFromGMT crashed - ios

As title said, My app crashed on client side and get reported via Parse crashes report but I just can't reproduce it on my side.
Everything working just fine on both simulator and real device also downloaded app from app store working flawlessly. But I keep getting crash report until today.
Here's the code for get timezone as integer
static var timezone: Int {
get {
return Int(NSTimeZone.localTimeZone().secondsFromGMT/3600) ?? 0
}
}
It shouldn't be any problem there but crash log end at that line or maybe I just missing something there. Please advice if someone hit this before. Any idea is welcome.

I have found that it crashes in Pacific timezone when you cast it to Int. in my case the following fixed the problem
let time = UInt32(NSDate().timeIntervalSince1970 + NSTimeInterval(NSTimeZone.localTimeZone().secondsFromGMT))

Related

Firebase Crashlytics Custom Log Only Log Single Line

Recently my app has been crashing while trying to deserialize the JSON sent from the server and unfortunately the server doesn't record any log so I can't verify with them. So I decided to log the JSON response for this particular Api, I know that it's a bad practice to log server response but it's the only way I could try to identify the issue, the response for this api is not that long so I think it should be fine.
The issue comes in when I tried to reveal the log and found out it only shows one line in the firebase console as below:
raw response : {
The result I was expecting were something as below,vit shows up nicely in the debug console while developing using CLSNSLogv. I thought it will be the same in firebase console too but it was not the case.
raw response : {
success ={
Status = OK;
Object1 = "test"
Object2 = "test2"
};
}
Below is the code for logging, "value" is a dictionary as below:
value: [String : AnyObject]?
CLSLogv("raw response : %#", getVaList([value!]))
Appreciate your help
This is a Crashlytics issue, my team has been experiencing this issue lately. We were printing dictionary using CLS_LOG in ObjC and we've noticed that it displays only first line of the dictionary.
I've contacted Crashlytics support team, and a guy from there confirmed a bug and told me that he contacted their engineering team for a fix.
You can change the way of logging for now to display everything in single line, or log by log, or you can wait for a fix.
You can convert the response to JSON using JSONSerialization and then remove all the carriage returns so that it's all one line. If you log that modified value it should appear correctly in the Crashlytics logs.

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.

Firebase childbyAutoId returns the same strange key every time

When using childByAutoId, something really strange happens. Instead of getting a unique id, I get the following key every time:
-------------------0
I know keys are generated with client side timestamps, so I tried running my code through the iOS simulator and an actual device, same result though.
I don't do anything interesting in my code, but here it is for reference:
func sendRandomMessage() {
let firebaseRootRef = Firebase(url:firebaseRootUrl)
let newMessageRef = firebaseRootRef.childByAutoId()
println(newMessageRef.key)
}
I'm using Firebase 2.3.0
There was a bug in the Firebase SDK for iOS 2.3.0 that caused this problem.
It has been fixed in 2.3.1. See https://www.firebase.com/docs/ios/changelog.html

.or query in parse unity crashes on iOS

I'm doing a .or query which in every platform works fine except in iOS.
As soon it reaches the line where it does the .or, it crashes with:
System.Collections.Generic.List> doesn't implement interface System.Collections.Generic.IEnumerable>
Assertion: should not be reached at mini-trampolines.c:183
Here's the code:
var isChallenger = ParseObject.GetQuery("Match")
.WhereEqualTo("Challenger",fb.loggedUser);
var isChallenged = ParseObject.GetQuery("Match")
.WhereEqualTo("Challenged",fb.loggedUser);
ParseQuery<ParseObject> query = isChallenger.Or (isChallenged); // Crashes here.
I'm doing it just like in the docs, not sure what's wrong.
Any help would be much appreciated!
Thanks,
Pablo
I think this is a bug I reported here: https://developers.facebook.com/bugs/750897958275392/
Except, I only saw this bug when using ParseQuery. The workaround I used is to use ParseQuery only, but I see you're already doing that. Is the code you posted exactly the same as the code you're actually using?

Resources