Support

Why don't messages get sent if I am using the FLEX library?

If you use FLEX and Layer together any uploaded rich content progress will appear to be stalled at 99%, but the operation had fully completed.

More info:

The LayerKit SDK uses the `NSURLSessionUploadTask` object to upload external content to our cloud storage. These objects are created by an `NSURLSession` object which also reports the outcome of the upload tasks via the `NSURLSessionDelegate` methods. LayerKit depends on one particular method, `URLSession:task:didCompleteWithError:` to determine when an upload operation has finished. Regardless of the success or failure of the operation, we rely on this method to inform us of the outcome. This information is then reported to you.

The FLEX library swizzles `NSURLSession` delegate methods and in doing so, does not respect the original invocations of those methods. See the following code for how they are doing this:

https://github.com/Flipboard/FLEX/blob/master/Classes/Network/PonyDebugger/FLEXNetworkObserver.m#L825

As a result, the `NSURLSessionDelegate` methods do not get called on our objects, thus preventing preventing LayerKit from learning the outcome of an external content upload operation.

For more info on method swizzling, see http://nshipster.com/method-swizzling/

Have more questions? Submit a request