Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
371 Check conformance on call to optional method
A rare crash found in WooCommerce iOS was caused by access to the `filename` of an asset, which is an optional member of the `WPMediaAsset` protocol. In WCiOS, this was not implemented, so the app crashed with `NSInvalidArgumentException -[WooCommerce.CancellableMedia filename]: unrecognized selector sent to instance` To prevent this, we check for `respondsToSelector:` before getting the filename, and default to using the creation date in the accessibility labels for documents when filename is not implemented. The fallback to creation date matches the existing approach taken for other media types.
- Loading branch information