C++获取iOS .app路径

2018-11-01  本文已影响0人  十五_ed26

#ifdef __APPLE__

    CFBundleRef ref = CFBundleGetMainBundle();

    CFURLRef fileURL = CFBundleCopyResourcesDirectoryURL(ref);

    CFStringRef filePath = CFURLCopyFileSystemPath(fileURL, kCFURLPOSIXPathStyle);

    CFStringEncoding encodingMethod = CFStringGetSystemEncoding();

    constchar*path =CFStringGetCStringPtr(filePath, encodingMethod);

    resPath= path;

#endif

上一篇 下一篇

猜你喜欢

热点阅读