News for hackers. Stuff that matters.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by linux2647 on Friday July 10, 2020 @10:43AM (#23791930)
I disagree. While, yes, Facebook needs to test their SDK, app developers need to build resiliency into their apps to ensure third party dependencies don’t break their app. The developer adopted it into their app; it’s their responsibility to do the proper checks in cases like these where Facebook broke things on their end.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by monocularvision on Friday July 10, 2020 @10:48AM (#23791991)
This is a native SDK that is crashing the process. There is nothing an app developer can responsibly do to prevent or recover from this crash.

Other than remove the SDK, of course.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by hyko on Friday July 10, 2020 @11:39AM (#23792643)
Yes there is: a remote kill switch that prevents the third party SDK from loading. That puts you back in control of the software you’re shipping.

Fool me once, and all that.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @12:01PM (#23792882)
You have to be technically competent enough to know how to dynamically load a framework, though.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by liuliu on Friday July 10, 2020 @01:52PM (#23794256)
And most SDKs are provided as static frameworks. You have to be technically competent to know how to wrap a static framework as dynamic, and then use dlopen to load them properly with a rather high one-time runtime cost. A mess.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by bognition on Friday July 10, 2020 @12:29PM (#23793201)
For a tech company with a multi-billion dollar valuation this shouldn't be insurmountable
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @01:00PM (#23793590)
Facebook knows how dynamic loading works. (At least, I think so…) However, their many clients may not, as a lot are not multi-billion dollar companies.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by XCSme on Friday July 10, 2020 @10:56AM (#23792099)
So there is no way to try {} catch {} it, right?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by Sephiroth87 on Friday July 10, 2020 @11:00AM (#23792156)
Not in this case, as it's not code explicitly called by the client, but automatically loaded on app launch...
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @12:02PM (#23792892)
Yes, but 1. it’s hard to inject that as the crash happens very early at launch and 2. Objective-C exceptions of this type are not intended to be caught.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by robterrell on Friday July 10, 2020 @12:54PM (#23793516)
That's not strictly true, and anyway it's different for the app developer versus a library provider. If you're making a 3rd party SDK that can throw, you need to make it can catch those throws.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @01:05PM (#23793659)
NSInvalidArgumentException is not intended to be caught. You can, of course, but receiving one indicates a serious run-time error.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by valuearb on Friday July 10, 2020 @11:59AM (#23792865)
If it's an objective C exception, you can catch those with an objective c wrapper function. Ive done that before in my Swift projects.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by ryandrake on Friday July 10, 2020 @05:15PM (#23796560)
> Other than remove the SDK, of course.

Bingo! App developer voluntarily pulled in a dependency which they didn't fully understand. When you bring in a dependency, it's not still someone else's code/problem, it becomes your problem.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by corndoge on Friday July 10, 2020 @10:46AM (#23791959)
Ah yes.

If hacker news goes down while you are writing this comment, it is your responsibility to ensure you can still post your comment despite the service breakage.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by slipheen on Friday July 10, 2020 @10:59AM (#23792138)
Unless your app is designed for browsing Facebook, there's no reason that anything on Facebook's servers should affect if your app works.

Many of the apps crashing are using Facebook for a portion of their app, such as one login option.

Letting that take down the whole app is insufficiently defensive coding, whether in the app, sdk, or glue between them.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by frenchy on Friday July 10, 2020 @11:24AM (#23792435)
> there's no reason that anything on Facebook's servers should affect if your app works.

Absolutely, but the problem is that in order for you to use these features, you're supposed to use the official Facebook SDK. The additional problem, is that Facebook has no interest in defensive coding, because if you're not interacting with Facebook in an app, there's no benefit to Facebook for you using that app at all.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by corndoge on Friday July 10, 2020 @11:19AM (#23792373)
How do you defend against abort() in library code?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by Nextgrid on Friday July 10, 2020 @11:35AM (#23792577)
Don't include libraries which contain such code?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @12:03PM (#23792905)
No abort here, the crash is coming from the runtime, which you’re not opting out of if you want your app to work.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by slipheen on Friday July 10, 2020 @06:23PM (#23797273)
Then we can agree the FB sdk should have been better written to avoid this, right?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by corndoge on Friday July 10, 2020 @06:49PM (#23797490)
Obviously, and now we agree!
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by yreg on Friday July 10, 2020 @10:48AM (#23791980)
So how could the app developers have prevented this, other then not using the SDK? (I'm not advocating for using the SDK.)
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by mattgreenrocks on Friday July 10, 2020 @10:50AM (#23792009)
Would disabling SDK autoinit have fixed this? That was a suggestion raised back in March. Seems like a net win to avoid static initializers in the first place.

(Am not a mobile dev, but it wasn't exactly hard to find that, either).

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by Sephiroth87 on Friday July 10, 2020 @11:03AM (#23792178)
Maybe (although some people report that not working), but not necessarily, as "autoinit" is just an if case checked in the same auto executed code in the Facebook SDK, which could still crash before the flag is checked.