acton393 / WeexLottie

Weex lottie component
27 stars 8 forks source link

Loading local json files #7

Open dseeker opened 6 years ago

dseeker commented 6 years ago

Can't seem able to load a local lottie json file. I tried this but nothing shows. src="local:///bundlejs/filename.json"

Then I tried getting the json content into a variable and load it using sourceJson parameter, but it fails <lottie :sourceJson='{"v":"5.1.8","fr":29.9700012207031,"ip":0,"op":60.0000024438501,"w":100,"h":100,"nm":"Spinner","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"spinner Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2},"a":{"a":0,"k":[160,284,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,19.882],[19.882,0],[0,-19.882],[-19.882,0]],"o":[[0,-19.882],[-19.882,0],[0,19.882],[19.882,0]],"v":[[36,0],[0,-36],[-36,0],[0,36]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"n":["0p667_1_0p167_0p167"],"t":0,"s":[100],"e":[0]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"n":["0p833_1_0p167_0"],"t":29,"s":[0],"e":[0]},{"t":51.0000020772726}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":20,"s":[100],"e":[1]},{"t":60.0000024438501}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.321568638086,0.321568638086,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":10,"ix":5},"lc":2,"lj":1,"ml":10,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[160,284],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"n":["0p667_1_0p167_0p167"],"t":0,"s":[-90],"e":[270]},{"t":59.0000024031193}],"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60.0000024438501,"st":0,"bm":0}],"markers":[]}' loop=true style='width:300px;height:300px' ref='lottie3'></lottie>

This is the error it throws up

 -[__NSDictionaryM dictionary]: unrecognized selector sent to instance 0x174243450
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM dictionary]: unrecognized selector sent to instance 0x174243450'
*** First throw call stack:
(0x18c2bafe0 0x18ad1c538 0x18c2c1ef4 0x18c2bef54 0x18c1bad4c 0x100137960 0x10013710c 0x1001a9a10 0x1001a68b4 0x1001a67b0 0x10014de70 0x1001a43e8 0x18cdaf50c 0x18c26942c 0x18c268d9c 0x18c2669a8 0x18c196da4 0x18ccb1db4 0x1001a42d8 0x18cdaf318 0x18b37d68c 0x18b37d59c 0x18b37acb4)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

What is the proper procedure for loading local files?

acton393 commented 6 years ago

hi @dseeker sourceJson property loading is a bug I confirmed , and I will fix it and release a newer version, you can have a try in src="local://bundlejs/filename.json"

dseeker commented 6 years ago

@acton393 I tried that and couldn't get it to work, which is why I started trying loading with sourceJson. for src="local://bundlejs/filename.json", first I intentionally put the wrong local filename, then I get Invalid local resource. I then correct it, and the error does not show again, signifying it found the file. But still nothing gets loaded in the UI. Only if I use http online url it starts working, not sure if there's something wrong with the iOS loading

acton393 commented 6 years ago

@dseeker yeah it should be wrong with the loading of plugin in iOS, I try to fix the loading crash on a new version, and try to fix the loading of local file as soon as possible