Unable to impor sketch file due to missing font even it exists

Actually, I checked the font book and the font and the font subfamily is present on my system. I am not sure what the issue is then. Can you import this sketch file on your machine?

Hi,

This issue is fixed in the next version. Currently the System Font will only work with some font faces. If you want to try this now change your example from the System Font to Helvetica Neue in Sketch (this is the same font), or wait for 0.9.3.

Okay we are getting there! :slight_smile:

Got rid of the problematic font and now it could generate the .ux file. But when I try to run the app, I get another error which is confusing:

.UX file: https://gist.github.com/vinaykr/8ffc9acc3096d6724ca0

Build Output:

Connected to fuse daemon

Building project ‘test’, target ‘(default)’

Configuring

Uno: 0.9.2-OSX Project: /Users/vinay/dev/projects/fuse-test/test/test.unoproj /Users/vinay/dev/projects/fuse-test/test/robinhood-ios-app-ui-thecoolgeeknet.sketch.ux(37,20): E1114: Expected ‘{’, found ‘-’ after namespace name /Users/vinay/dev/projects/fuse-test/test/robinhood-ios-app-ui-thecoolgeeknet.sketch.ux(42,1): E1108: Unexpected token ‘RightCurlyBrace’ Packages: UnoCore (0.16.4), Fuse.Designer (0.15.3), Uno.Collections (0.16.2), Uno.Geometry (0.16.2), Uno.Threading (0.16.4), FuseCore (0.15.3), Experimental.Physics (0.15.3), Fuse.Animations (0.15.3), Fuse.Drawing (0.15.3), Fuse.Drawing.Batching (0.15.3), Fuse.Drawing.Meshes (0.15.3), Fuse.Drawing.Planar (0.15.3), Uno.Net.Http (0.16.4), Experimental.Http (0.15.3), Fuse.Triggers (0.15.3), Android (0.16.3), ObjC (0.16.1), Experimental.iOS (0.16.1), Experimental.TextureLoader (0.16.2), Fuse.Elements (0.15.3), Fuse.Drawing.Primitives (0.15.3), Fuse.Drawing.Polygons (0.15.3), Fuse.Drawing.Paths (0.15.3), Fuse.Entities (0.15.3), Fuse.Gestures (0.15.3), Fuse.Navigation (0.15.3), Fuse.Shapes (0.15.3), Fuse.Controls (0.15.3), Fuse.Effects (0.15.3), Fuse.Physics (0.15.3), Fuse.BasicTheme (0.15.3), Fuse.Video (0.15.3), Fuse.Themes (0.15.3), Fuse.Camera (0.15.3), Fuse.Storage (0.15.3), Fuse.Vibration (0.15.3), Fuse.Launcher (0.15.3), Fuse.Messages (0.15.3), Fuse.GeoLocation (0.15.3), Fuse.Scripting (0.15.3), Uno.Data.Json (0.16.2), Fuse.Scripting.Duktape (0.15.3), Fuse.Scripting.JavaScriptCore (0.15.3), Fuse.Scripting.Jurassic (0.15.3), Uno.Net.Sockets (0.16.2), Fuse.Scripting.V8 (0.15.3), Fuse.Reactive (0.15.3), Fuse.Android (0.15.3), Fuse.Desktop (0.15.3), Fuse.iOS (0.15.3), test (0.0.0) (2,409.37 ms)

Build completed in 2.41 seconds 0 Warning(s) 2 Error(s)

Error Summary

/Users/vinay/dev/projects/fuse-test/test/robinhood-ios-app-ui-thecoolgeeknet.sketch.ux(37,20): E1114: Expected ‘{’, found ‘-’ after namespace name /Users/vinay/dev/projects/fuse-test/test/robinhood-ios-app-ui-thecoolgeeknet.sketch.ux(42,1): E1108: Unexpected token ‘RightCurlyBrace’ FATAL ERROR: Build failed.

Yes. Try renaming your UX to not use - . This is also fixed in the next version.

I am getting more weird errors like “Sequence contains no matching element - (0:0)” .

Please send me your updated .sketch file.

Here you go. https://fuseweb.azureedge.net/forum-user-uploads/2016/08/22/GbhXat8HuxiA-legacy-files-4DHp0x1JkfLSNsKU-552whIKKYHngRUysRrsyVHsj.zip

thanks!

I’m unable to recreate the problems you are having. Both running fuse import robinhood.sketch, and running fuse preview and dropping the .sketch-file on top of the preview window is working for me with that file.

Running Fuse 0.9.2.

Can you describe what you are doing and post the complete log?

Okay, here are the steps:

  1. Open fuse dashboard and click Project > New

  2. Select “Fuse Project” option and an empty folder for the project and click Ok

  3. Copy robinhood.sketch file into project folder

  4. “fuse import robinhood.sketch”

  5. “fuse preview”

  6. Fuse preview opens an empty App because there was a file called MainView.ux which was empty shell of app with App tag.

  7. I moved all the code in robinhood.sketch.ux within the App tag and now I am getting the following error:

/Users/vinay/dev/projects/fuse-test/test1/MainView.ux: EUNKNOWN: An item with the same key has already been added. /Users/vinay/dev/projects/fuse-test/test1/MainView.ux: EUNKNOWN: An item with the same key has already been added.

May be I doing something completely wrong here. thanks for the help!

Hi,

Try one of these approaches:

_4. “fuse preview”
_5. Drag robinhood.sketch file into the preview window

Or:

_4. “fuse import robinhood.sketch --overwrite-app”
_5. “fuse preview”

You are not doing anything wrong. You cannot copy the things in the ux, as this will duplicate the assets, and you get a naming conflict.

Please let me know how it goes.

That Worked! Thanks a lot for sticking to help out with this problem. You guys are amazing!

Some follow up questions on the imported sketch file:

  1. Absolute Positioning: All elements created use absolute positioning. Is there a good way to impose “best guess” relative positioning when the .ux file is generated? I know this is a very hard problem and might not be supported but I just wanted to ask.

  2. What is the best way to go about converting automatically generated .ux code to a real app? From what I see, I can just use the assets but I’ll have to rewrite most of the markup code to use more layout structures like StackPanel, DockPanel and Grid.

But this is already pretty amazing. You guys have built a great tool! Congrats and best of luck!

Glad to hear you got it working.

  1. Yes it has absolute positioning now. So right now it is best to check the sketch file on a mobile device, and to get the assets. We can change the positioning to percent, but that will not solve the real problem. We are pursuing the path of a “best guess” relative positioning, but have not made anything yet.

  2. Yes. That is the current best way. Use the assets and rewrite the markup code. That is why the option to overwrite the app is optional. We are very interested in feedback on ideas to make this part of the app more useful.

Yes that problem is really tricky. I’ll let you guys know if I come accross any ideas.

I have downloaded another sketch file but I am getting another error while importing that file. Not sure if it is a bug.

Here is the error:

Unhandled Exception: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: SketchImporter.JSON.DynamicDictionary' does not contain a definition forNSFontNameAttribute’ at (wrapper dynamic-method) object.CallSite.Target (System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,object) <0x00103>

Full Error: https://gist.github.com/vinaykr/70c0286d8d18e1dce710

Sketch file: https://fuseweb.azureedge.net/forum-user-uploads/2016/08/22/CAhbshjSmxNX-legacy-files-pDR3dSm9Kxp1yf9G-irG8A496nHNJuK3i8CWQLbBb.zip

thanks for the help!

It might have to do with the font “.AppleSystemUIFont” which was defaulted on all the strings in this sketch file. I changed it to use a specific font (like Helvetica) and it started to work! May be this condition needs to be handled by the previewer?

Thank you for that example. The reason for the crash is that the text haven’t gotten a text defined in sketch, and the SketchImporter does not have a default font yet.

The case with a missing default font has been fixed, and the next version of the SketchImporter will handle this.