remuslazar/osx-xliff-tool

Unable to save

Closed this issue · 15 comments

non-crashing exception, looks like from line 117 of ViewController.swift:

2016-10-31 14:22:00.275 XLIFFTool[5797:1088498] -[_SwiftValue updateTranslationForElement:newValue:]: unrecognized selector sent to instance 0x60800009fcc0

@SimplGy I think this could be a side effect of 7c66d26. Could u send me your xliff-file so I can reproduce it? With my test xliff files everything runs smoothly..

Odd. I can do a fresh pull. For me it happens even with "asdf" as a string (no fancy chars, no multiline). If I comment out this line it doesn't raise an exception, but still does not save:

(document?.undoManager?.prepare(withInvocationTarget: self) as AnyObject)

I can send you the xliff. It's work's data though, Is there a private channel I can use?

could you try to edit/save this file, just to isolate the problem? Else it could be a certificate/ACL issue, as you mentioned.

https://github.com/remuslazar/osx-xliff-tool/blob/develop/xliff-toolTests/fixtures/de.xliff

Good idea. Same behavior with that file, so must be permissions/environment. I wish it wasn't a silent fail though. The undoManager throws an exception but the save failure is totally ninja.

Is there a way to hook into the save/postSave callback and detect/log a failure?

image

@SimplGy because the App is using the App Sandbox (required anyway for AppStore Submission and generally a good thing..) you need a valid developer account to be able to save files on the local filesystem AFAIK.

For testing purposes you could just disable the App Sandbox (in the Capabilities Tab) altogether, to see if this resolves this issue.

I've signed it with a valid cert by changing the team. It wouldn't let me build without it:

image

I can save if I comment out the undoManager. I didn't think that was the case but maybe I tested too fast and missed it:

//  (document?.undoManager?.prepare(withInvocationTarget: self) as AnyObject)
//                .updateTranslationForElement(elem, newValue: target.stringValue!)

Or, I have a fix that guards around the undoManager and I've tested that undo is still functional and saving works.

ok, this is weird. Could be an issue introduced by the Swift3 Migration. Unfortunately there is no TestFlight for MacOS Apps, this would make the debugging easier.

Oh, I forgot about that possible environment difference. You on xcode 8?

image

Version 8.1 (8B62), this is the current one (non-beta)

Hmm. It's possible that's the cause, but I can't afford to upgrade and check because it could disrupt my client project. We had a nightmare of a time with xcode upgrades during the beta and I'm hesitant to risk a repeat :/

I think 8.1 is painless, it introduces only the TouchBar support and Swift 3.0.1 with some bugfixes

I'm sorry, I just can't upgrade right now. I have to wait until my collaborator is ready to upgrade so we don't have any chance of introducing any inconsistency problems.

I didn't see any syntax warns opening your project so I think it's unlikely the xcode version mismatch is a cause, but it certainly could be.

@SimplGy, could you check if 26bce12 solves the exception on save? Even though I cannot reproduce the issue, I'm quite confident that this will fix it.

Yup, works great.

I wish I understood the solution better. I understand the first part: It is valid to cast nil to AnyObject, but then if you try to send a message to it (run a selector on it) in the future it will fail.

But in what situation would document?.undoManager?.prepare return nil?
Maybe just a timing issue and not worth tracking down?

Closed by 26bce12