Giter Club home page Giter Club logo

Comments (4)

ncreated avatar ncreated commented on May 20, 2024 1

Fixed in 1.0.1

from dd-sdk-ios.

ncreated avatar ncreated commented on May 20, 2024

Hey @lmramirez 👋. Thanks for details, this pretty much narrows the issue to one particular place in the SDK. We will work on this with the highest priority and see what's possible to solve this issue.

As a side note - this unfortunately comes from Apple's FileHandle API limitation. Here's verbose a comment we left in our code:

func appendData(_ data: Data) {
/*
Apple documentation https://developer.apple.com/documentation/foundation/filehandle/1410936-write says
that `fileHandle.write()` raises an exception if no free space is left on the file system,
or if any other writing error occurs. Those are unchecked exceptions impossible to handle in Swift.
It was already escalated to Apple in Swift open source project discussion:
https://forums.swift.org/t/pitch-replacement-for-filehandle/5177
Until better replacement is provided by Apple, the SDK sticks to this API. To mitigate the risk of
crashing client applications, other precautions are implemented carefuly.
*/
fileHandle.write(data)
}

We'll try to install additional checks around to mitigate this as much as possible.

from dd-sdk-ios.

lmramirez avatar lmramirez commented on May 20, 2024

@ncreated thank you!

I'm familiar with the same issue since we actually ran into it in our application. For what it's worth, we ended up implementing an objective-c method to catch the exceptions. Not super pretty, but seems wo work well. Posting here in case it's helpful:

#import "ObjCExceptions.h"

@implementation ObjCExceptions

+ (BOOL)catchException:(void(^)(void))tryBlock error:(__autoreleasing NSError **)error {
    @try {
        tryBlock();
        return YES;
    }
    @catch (NSException *exception) {
        *error = [[NSError alloc] initWithDomain:exception.name code:0 userInfo:exception.userInfo];
        return NO;
    }
}

@end

There is probably a nicer way to do this using a function instead of a static method too.

from dd-sdk-ios.

ncreated avatar ncreated commented on May 20, 2024

Thank you @lmramirez 💪. This might be tricky as SPM doesn't allow mixing Obj-C with Swift code inside single package, and separating packages will not work easily for Cocoa Pods, but we'll have a look and fix this ASAP.

from dd-sdk-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.