简体   繁体   English

如何通过Qt5获取ios文档/库路径?

[英]How to get the ios document/library path through Qt5?

I used find my ios app's document/library path by going up starts from QApplication::applicationDirPath() . 我曾经通过从QApplication::applicationDirPath()开始查找ios应用程序的文档/库路径。

However from iOS 7/8, the bundle path is moved away from data path. 但是,从iOS 7/8起,束路径从数据路径移开了。

So how can I get my app's writable paths through Qt C++ only? 那么,如何仅通过Qt C ++获得应用程序的可写路径? Is there a correct way that packed with Qt? Qt是否有包装正确的方法?

I don't want to write on APPROOT 's document. 我不想在APPROOT的文档上写。 And I understand that I can write objective-c codes to find the path. 而且我知道我可以编写Objective-C代码来查找路径。

So my app is installed at: 所以我的应用安装在:

/var/mobile/Containers/Bundle/Application/XXXX/ / var / mobile /容器/捆绑/应用程序/ XXXX /

What I want to get is 我想要得到的是

/var/mobile/Containers/Data/Application/YYYY/Documents / var / mobile /容器/数据/应用程序/ YYYY /文档

/var/mobile/Containers/Data/Application/YYYY/Library / var / mobile /容器/数据/应用程序/ YYYY /库

note that the bundle's long id (the XXXX) is different from Data's (the YYYY) 请注意,捆绑商品的长ID(XXXX)与数据的长ID(YYYY)不同

If you need to take the document or any other standard library directories path, use QStandardPaths from Qt5 : 如果需要使用文档或其他任何标准库目录路径,请使用Qt5 QStandardPaths

QStandardPaths::AppDataLocation

For other paths consider to read the official Qt docs about QStandardPaths 对于其他路径,请考虑阅读有关QStandardPaths的官方Qt文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM