Potential Issue Identified in Apple Documentation

While reviewing the Apple Documentation, I came across a potential issue in one of the examples that I believe is worth addressing.

The example appears to compare strings instead of integers, which could lead to unexpected behavior in production environments. Specifically, in the line where originalMajorVersion (a string) is compared with newBusinessModelMajorVersion (also a string) using <:

if originalMajorVersion < newBusinessModelMajorVersion
This comparison performs a lexicographical check rather than evaluating the numerical values of the strings. As a result, strings like "10" would incorrectly be considered less than "2", which is not the desired behaviour when comparing version numbers.

I have reported this via the Feedback assistant (FB16432337) but at the time of posting this there has been no reply at all (23 days)

Supporting business model changes by using the app transaction

do {
    // Get the appTransaction.
    let shared = try await AppTransaction.shared
    if case .verified(let appTransaction) = shared {
        // Hard-code the major version number in which the app's business model changed.
        let newBusinessModelMajorVersion = "2" 


        // Get the major version number of the version the customer originally purchased.
        let versionComponents = appTransaction.originalAppVersion.split(separator: ".")
        let originalMajorVersion = versionComponents[0]


        if originalMajorVersion < newBusinessModelMajorVersion {
            // This customer purchased the app before the business model changed.
            // Deliver content that they're entitled to based on their app purchase.
        }
        else {
            // This customer purchased the app after the business model changed.
        }
    }
}
catch {
    // Handle errors.
}

Apple's documentation is only designed to demonstrate API usage. It shouldn't be used as a guide for program logic. Just look at the error handler.

I have issues outstanding that I haven't received a response to for years. I don't expect a response, and for you to complain that your minor issue in one bit of documentation hasn't been addressed in, gosh, just 23 days, is asinine.

Any good developer would test their code to confirm it works before sending it to production, and if they'd found an issue, they'd raise it and move on. They wouldn't grumble about not being contacted.

And another thing. Don't use the "Comments" feature here in the forums. At first I thought it was just a good way to get your post missed and ignored. But now I see another, much more serious bug. I see a label saying "2 comments" under my reply but only one comment is shown when I click on it. If you really did make 2 comments, one has been lost for good.

If you don't adjust your expectations, you're setting yourself up for some serious disappointment.

Potential Issue Identified in Apple Documentation
 
 
Q