Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OC 调用Bug #31

Closed
vergilw opened this issue May 18, 2017 · 5 comments
Closed

OC 调用Bug #31

vergilw opened this issue May 18, 2017 · 5 comments

Comments

@vergilw
Copy link

vergilw commented May 18, 2017

下载到Documents里的plist文件,在调用setThemeWithPlistInSandbox方法的时候,会自动在plist文件名参数后拼接一个.plist后缀,导致原本的文件名由xxx.plist变成xxx.plist.plist,然后识别失败。

SwiftTheme WARNING: Not read plist 'momentsBear_theme.plist' with: /Users/fiber/Library/Developer/CoreSimulator/Devices/1FEF7344-AA28-494C-9B96-B4DF9D6F285F/data/Containers/Data/Application/D9F52344-3E99-42A8-819B-2C471D349709/Documents/Theme/1/theme3x/momentsBear_theme.plist.plist

@wxxsw
Copy link
Owner

wxxsw commented May 18, 2017

是的,在 Swift 中或者使用 mainBundle 也都是只需要传文件的名称,后缀是由 SwiftTheme 来添加

你可以去掉你添加的后缀,如果你觉得这种方式不合理,请告诉我你认为的原因 :)

@vergilw
Copy link
Author

vergilw commented May 18, 2017

mainBundle可以识别,但是Documents目录是由网络下载下来的,路径每一层级的路径都不能容错,路径要持久化在本地,跟mainBundle里仅仅使用一个文件名来应用文件还是有差别的。建议你改成先识别plist是否含有.plist文件扩展,再选择性的添加后缀,强制添加后缀总是不合理的。

请问你在持久化Documents文件路径和plist文件名的时候,保存的是不含文件扩展的部分吗?

@wxxsw
Copy link
Owner

wxxsw commented May 18, 2017

现在逻辑是这样的,OC 应该是调用这个方法

public class func setThemeWithPlistInSandbox(_ plistName: String, path: URL) {
    setTheme(plistName: plistName, path: .sandbox(path))
}

第一个参数传入不带后缀的 plistName,第二个参数是主题所在的 URL,因为第一个参数只是指定了名称,所以 plist 必须放在 URL 下的根目录。

然后 SwiftTheme 会把 plist 转为字典,存在变量中,并不会有其他持久化的操作,不知道我是不是回答了你的问题。

@wxxsw
Copy link
Owner

wxxsw commented May 18, 2017

强制添加后缀可能不太好,因为平时比较忙,我会在周末处理一下

@wxxsw
Copy link
Owner

wxxsw commented May 30, 2017

已处理,不强制添加后缀

@wxxsw wxxsw closed this as completed May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants