News for hackers. Stuff that matters.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by speedyapoc on Friday July 10, 2020 @07:48AM (#23790543)
My guess in this particular instance is that it seems like the Facebook SDK is fetching some sort of remote serialized configuration, calling “count” on what it expects to be an array, and instead is calling it on NSNull (an object representing “null”) which is throwing an exception.

There are some intricacies on iOS surrounding null values and serialization, and as a developer it is important to understand that you may encounter NSNull. As a standard practice in my company, we type check every remote value before calling anything on it. Seems like that would have prevented this issue.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by AndrewZM on Friday July 10, 2020 @08:15AM (#23790718)
This is exactly what happens. Basically a null value is converted into an NSNull object and calling count on it will of course throw an exception... because there is no count method in that class...

It makes me wonder what all those engineers at FB are actually doing... ? Every time I tried to integrate or look into the FB SDK for simple functionality it was a total clusterfuck.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by x86_64Ubuntu on Friday July 10, 2020 @09:38AM (#23791337)
That's amateur hour stuff. Every developer in pretty much every language or platform learns VERY quickly what happens when you don't do a null check.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by blago on Friday July 10, 2020 @10:23AM (#23791739)
NSNull is not the null you think
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by x86_64Ubuntu on Friday July 10, 2020 @10:58AM (#23792124)
It may not be a conventional null, but I'm not aware of any tech where calling "count" on a Null, .nil? or otherwise null-like construct won't end horribly.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by plorkyeran on Friday July 10, 2020 @11:54AM (#23792813)
The Facebook SDK is written in obj-c, where calling `count` on `nil` is perfectly valid and returns 0. It only doesn't work on NSNull, which is a weird different thing that does not work like the language's built-in null.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by zentiggr on Friday July 10, 2020 @09:08AM (#23791076)
Sounds like a good reason to stop trying.

A bit of snark but also maybe stop trying to use a data collection engine to leverage anything for yourself?

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by akmarinov on Friday July 10, 2020 @07:59AM (#23790608)
Could also be a string that’s no longer there

Source: have had that issue before

Also maybe it’s time for them to start rewriting things in Swift, where this would be much less likely to happen

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by sciprojguy on Friday July 10, 2020 @08:15AM (#23790722)
True enough. Swift Codable with optional properties handles this automatically.