Xcode 8 localization import crash
Asked Answered
F

3

9

Xcode (8.1) is crashing when I import the localizations for my project. It also crashes when I export and then import the same xliff file whithout modification.

Here is the xliff file: http://ge.tt/7J5UY3i2

Here is the full crash report http://pastebin.com/JsJFeCqB. Any tips or workarounds for this?

Application Specific Information:
ProductBuildVersion: 8B62
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[Xcode3VariantGroup addToTargetDefaultResourcesBuildPhase:]: unrecognized selector sent to instance 0x7fe69615cba0
UserInfo: (null)
Hints: None

Backtrace:
  0   __exceptionPreprocess (in CoreFoundation)
  1   DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2   objc_exception_throw (in libobjc.A.dylib)
  3   -[NSObject(NSObject) doesNotRecognizeSelector:] (in CoreFoundation)
  4   ___forwarding___ (in CoreFoundation)
  5   _CF_forwarding_prep_0 (in CoreFoundation)
  6   __81+[IDELocalizationWork fileReferenceStreamForName:directoryPath:superitem:target:]_block_invoke (in IDEFoundation)
  7   __33-[IDEStream(IDEStreamMonad) map:]_block_invoke (in IDEFoundation)
  8   __24-[_IDEStreamMap onNext:]_block_invoke_4 (in IDEFoundation)
  9   -[_DVTTimeSlicedMainThreadOrderedUniquingWorkQueue _processWorkItemsWithDeadline:] (in DVTFoundation)
 10   -[DVTTimeSlicedMainThreadWorkQueue _processWithDeadline:] (in DVTFoundation)
 11   -[_DVTTimeSlicedMainThreadActiveWorkQueues _processWorkQueuesOnDeadline] (in DVTFoundation)
 12   __NSFireDelayedPerform (in Foundation)
 13   __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation)
 14   __CFRunLoopDoTimer (in CoreFoundation)
 15   __CFRunLoopDoTimers (in CoreFoundation)
 16   __CFRunLoopRun (in CoreFoundation)
 17   CFRunLoopRunSpecific (in CoreFoundation)
 18   RunCurrentEventLoopInMode (in HIToolbox)
 19   ReceiveNextEventCommon (in HIToolbox)
 20   _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
 21   _DPSNextEvent (in AppKit)
 22   -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
 23   -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
 24   -[NSApplication run] (in AppKit)
 25   NSApplicationMain (in AppKit)
 26   start (in libdyld.dylib)
Funch answered 27/12, 2016 at 5:56 Comment(1)
Im having same issue. Did you find anything yet?Intermediacy
M
10

This issue kills me. The tool could/should work and make your life so much easier, but it just doesn't. I had this problem over the summer and fixed it with the info.plist tip in the first bullet, but I've recently updated the project and I'm back in xliff exception hell again. On the bright side, my current crash seems to be happening after it finishes doing the work so I am able to keep working.

There are a bunch of things that can go wrong and cause the import to crash. Usually Xcode just blinks out of existence. If you want to see some info before the crash, use xcodebuild:

xcodebuild -verbose -importLocalizations -localizationPath "lang.xliff" -project ./myProject.xcodeproj
  • When you localize, don't add a language directly to an info.plist. Instead add a InfoPlist.Strings file to your project and add the language to that. You may need to manually create the file in each lang.lproj folder. Make sure you don't have an info.plist file in any lang.lproj folder other than base.lproj.

  • When localizing Settings.bundle, create your lang.lproj folders. When you create the Root.strings file, capitalization matters. It must be "Root.strings" otherwise it might work on iOS, but it won't work on the iOS Simulator.

  • Look around in your project structure. After you work with the crashing tool you end up with a bunch of files in the wrong place. You can have a Localized.Strings file in the root group of your project. Remove those.

  • Only use base.lproj instead of en.lproj so manually remove en.lproj files if you find them in the project.

  • the XLIFF file does need to be well formatted, but I don't think that causes a crash.

  • not for you, but supposedly there was a specific crash fixed in Xcode 7 so make sure you are on the latest to avoid that one, at least.

I have some python scripts for living with xliff. They need source path's updated in some of the scripts, but they may help out in the long run: https://github.com/danloughney/xliffHell

Manella answered 2/2, 2017 at 3:50 Comment(3)
There must be something wrong with my project file or workspace. I have a new app which does not crash when importing XLIFFs. if you get this crash, maybe completely recreating the project will help.Manella
Using the command line approach allowed the import to work for me without any further changes. Xcode 10.1 would crash every time.Stickinthemud
This works great for me but XCode still crash when I import, guess I have to save this snippet.Michellemichels
P
0

One of your strings contains double quotes. Try replacing them by " in your untranslated XLIFF file and see if you can re-import that file. This is just a wild guess, and I do not have XCode 8.1 at hand to try and reproduce this myself, but this is the only thing I noticed in your XLIFF file that looked dodgy.

Pop answered 2/1, 2017 at 11:22 Comment(1)
Sorry... Next wild guess: your translated XLIFF does not validate against the XLIFF 1.2 strict schema. Some <note> elements occur before their <target>. I assume that this is not the case with the untranslated file, though. And the build-num attribute is not allowed in the <tool> element. You could also try prefixing those double quotes with a backslash: it seems strange, but for some people plain XML is not complicated enough, so they mix it with .properties syntax.Pop
N
0

Another hint: Make sure you do not translate CFBundleName and CFBundleDisplayName. XCode will crash during the last step of the import. This issue still exist in XCode 10.3.

Neural answered 15/9, 2019 at 7:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.