代码之家  ›  专栏  ›  技术社区  ›  Durgaprasad

Mac-使用pyinstaller本地化plist

  •  0
  • Durgaprasad  · 技术社区  · 7 年前

    我用pyinstaller创建了一个mac应用程序。我已将“NSCalendarsUsageDescription”、“NSContactsUsageDescription”添加到 Info.plist 这对于默认的英语语言很好。

    Infoplist.string 要本地化以上字符串的文件。我试着模仿 fr.lproj/Infoplist.string 在里面 build app/Contents/Resources

    我需要在中添加此引用吗 .spec 在什么地方存档?或者其他我缺少的东西。

    我在xcode10中创建了一个测试应用程序。在中添加了“NSCalendarsUsageDescription”信息列表 添加了以下代码

    NSArray* dirs = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:[NSHomeDirectory() stringByAppendingPathComponent:@"/Library/Calendars"] error:&error];
    

    Error Domain=NSCocoaErrorDomain Code=257 "The file “Calendars” couldn’t be opened because you don’t have permission to view it." UserInfo={NSUserStringVariant=(
        Folder
    ), NSURL=file:///Users/insync/Library/Calendars, NSFilePath=/Users/insync/Library/Calendars, NSUnderlyingError=0x600000c5c870 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
    

    根据 https://developer.apple.com/videos/play/wwdc2018/718/ ,Mac Mojave应该给出一个用户同意提示,要求用户授予使用日历的权限。

    我已签署此应用程序并尝试。还是一样的错误。

    1 回复  |  直到 7 年前
        1
  •  0
  •   Durgaprasad    7 年前

    终于找到了问题所在。

    关于编辑的部分,我们需要从功能启用日历访问->沙盒。只有应用程序才能访问日历。