Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Error loading images from app-root iOS


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Apr 29, 2016 4:57 AM Last Post By: Yilmaz Yoru
Mike Collins

Posts: 46
Registered: 9/23/05
Error loading images from app-root iOS  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 28, 2016 10:39 AM
Hi All,

Hoping for a quick reply - app have just been rejected by Apple.

We have recently submitted an update to our App to Apple for approval. This time round (seems like a regular occurrence) they have not approved our update because we store a number of images in the {App-ID} /documents folder. I had noticed this mentioned sometime ago during one of a CodeRage seminars (http://edn.embarcadero.com/article/44190) but our app has been doing this since first release and Apple have never complained. We are using XE10 Update 1.

Anyway, we have moved all of the none user data into the root directory of the app (in the deployment bundle) and modified our code according to the link above i.e. ExtractFilePath( ParamStr(0) ). This however returns an empty string.

I then tried using the TPath::GetHomePath() which correctly returns the root path to our App i.e. /var/mobile/Containers/Data/Application/{App-GUID}/. I then concatenate this with the image name (ensuring correct case) using the TPath::Combine() method:

 
#define ABOUT_BANNER_IMG_L    u"About.png"
     
imgAbout->Bitmap->LoadFromFile( System::Ioutils::TPath::Combine( System::Ioutils::TPath::GetHomePath(), ABOUT_BANNER_IMG_L ) );


The resultant path looks correct when outputted. However I get an error message displayed (that I'm assuming is being raised by the image container) reporting that "Error - Loading bitmap failed (/var/mobile/Containers/Data/Application/{App-GUID}/About.png).

When I look in the deployment folder the image(s) is there. When I test for it using FileExists() it returns false.

Can anyone tell me where I am going wrong. Some posts I have read allude to the fact that the app's root directory cannot be read from. Is this correct? If so, where should none-user data be stored? Is the /tmp directory a better options.

Many thanks in advance

Mike C
Yilmaz Yoru


Posts: 167
Registered: 1/1/03
Re: Error loading images from app-root iOS  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 29, 2016 4:57 AM   in response to: Mike Collins in response to: Mike Collins
Mike Collins wrote:
Hi All,

Hoping for a quick reply - app have just been rejected by Apple.

We have recently submitted an update to our App to Apple for approval. This time round (seems like a regular occurrence) they have not approved our update because we store a number of images in the {App-ID} /documents folder. I had noticed this mentioned sometime ago during one of a CodeRage seminars (http://edn.embarcadero.com/article/44190) but our app has been doing this since first release and Apple have never complained. We are using XE10 Update 1.

Anyway, we have moved all of the none user data into the root directory of the app (in the deployment bundle) and modified our code according to the link above i.e. ExtractFilePath( ParamStr(0) ). This however returns an empty string.

I then tried using the TPath::GetHomePath() which correctly returns the root path to our App i.e. /var/mobile/Containers/Data/Application/{App-GUID}/. I then concatenate this with the image name (ensuring correct case) using the TPath::Combine() method:

 
#define ABOUT_BANNER_IMG_L    u"About.png"
     
imgAbout->Bitmap->LoadFromFile( System::Ioutils::TPath::Combine( System::Ioutils::TPath::GetHomePath(), ABOUT_BANNER_IMG_L ) );


The resultant path looks correct when outputted. However I get an error message displayed (that I'm assuming is being raised by the image container) reporting that "Error - Loading bitmap failed (/var/mobile/Containers/Data/Application/{App-GUID}/About.png).

When I look in the deployment folder the image(s) is there. When I test for it using FileExists() it returns false.

Can anyone tell me where I am going wrong. Some posts I have read allude to the fact that the app's root directory cannot be read from. Is this correct? If so, where should none-user data be stored? Is the /tmp directory a better options.

Many thanks in advance

Mike C

--

Hey Mike did u try this ? #define ABOUT_BANNER_IMG_L L"About.png"

I use this for files in temp, may be it helps to you. Files are in tmp because i am downloading a file then processing it.

String __fastcall GetFileName(const String AFileName)
{
#if defined(__ANDROID__)
return IncludeTrailingPathDelimiter(System::Ioutils::TPath::GetTempPath()) + AFileName;
#else
#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
return IncludeTrailingPathDelimiter(System::Ioutils::TPath::GetDocumentsPath()) +
AFileName;
#else
return System::Ioutils::TPath::Combine(System::Ioutils::TPath::GetTempPath(), AFileName);
#endif
#endif
}

--
Best Regards
Dr. Yilmaz Yoru
Esenja Company

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02