Is it possible to let my static framework access iOS application folders? [iOS]

0

Currently I am developing an SDK and it is best to be designed as a static framework. It shall access some network-downloaded resource files located in the application folder, like /var/mobile/Applications/... I tried to pass the absolute file path and it can not get the resource. Then I rebuild the SDK into a dynamic framework (with Embed&Sign in Xcode-General), it can access the application folder with no problem.

Are there anyways to make static framework have access to application folder?

dynamic-library ios static-libraries
2021-11-24 03:21:07
1

0

On the iOS platform of a real device, you cannot use the absolute path to access network-downloaded resource files located in the application folder because of the sandbox file system. instead, you can use NSDocumentDirectory API to access them. Before you access the file, you had better use fileExistsAtPath API to check if the file exists at the path.

If you are confused, you can use the framework named FLEX to confirm if the file is downloaded successfully.

2021-11-24 13:31:25

I am using NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); to get application support directory. In fact the path I got is /var/mobile/Containers/Data/Application/DD42D5DE-E18C-47A7-BE4A-92EE8E9718FB/Library/Application Support/... Since Dynamic Framework can access the files using this path, I am wondering if it is not the problem of this path.
MortyXiong

Before you access the file, you had better use fileExistsAtPath API to check if the file exists at the path. If you are confused, you can use the framework named FLEX to confirm if the file is downloaded successfully. @MortyXiong
ChenYilong

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................