C++获取iOS .app路径

#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

你可能感兴趣的:(C++获取iOS .app路径)