Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7878111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:34:03+00:00 2026-06-03T03:34:03+00:00

I am using PhoneGap 1.1.0 and iOS 5.0, and have struggled on FileWriter problem.

  • 0

I am using PhoneGap 1.1.0 and iOS 5.0, and have struggled on FileWriter problem.

Here’s the full example of http://docs.phonegap.com/en/1.1.0/phonegap_file_file.md.html#FileWriter
does work fine.
Creating a FileWriter from the onDeviceReady works.

However, since what I want to do is to create a FileWriter depending on
various filenames on demand, I did as follows:

(function ($){
document.addEventListener("deviceready", function ()
{
  var FSroot;
  window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onInitFs, errorHandler);

  function onInitFs(fs)
  {
       FSroot = fs.root;
       //.......
  }

  //.......

  function writeFile(myText1)
   {
      var filename = "namedProgramatically";

      alert("CHECK1");
      FSroot.getFile(filename, {create: true}, gotFileEntry, fail);

      function gotFileEntry(fileEntry)
                         {
                            alert("CHECK2");
                            fileEntry.createWriter(gotFileWriter, fail);
                         }

      function gotFileWriter(writer)
                         {
                            writer.onwrite = function(evt)
                                                  {alert("WRITE Done!!");};
                            writer.write(myText1);
                         }

      function fail(error)
                         {
                              alert(error.code);
                         }


   }
   //...........

 }); //========================
})(jQuery)

This code does not work.
I see “CHECK1” alert, but not “CHECK2”.
I have no clue, what is wrong?
Please give me some advice.
Thank you.

Ken

(edit)
The problem may be a JavaScript-JQuery scope issue although I’m not sure.
I have re-developed a FileWrite unit test code on iOS5.0+ PhoneGap1.1.0 + JQuery1.7, and finally it works as I intended.
Here is the full working code.(my Google Docs link)

https://docs.google.com/document/pub?id=1B58qVbIldDQ6s_WbPiCwB9MDnXxqlidUBbwQxNP2geg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:34:05+00:00Added an answer on June 3, 2026 at 3:34 am

    The problem may be a JavaScript-JQuery scope issue although I’m not sure. I have re-developed a FileWrite unit test code on iOS5.0+ PhoneGap1.1.0 + JQuery1.7, and finally it works as I intended. Here is the full working code.(my Google Docs link)

    https://docs.google.com/document/pub?id=1B58qVbIldDQ6s_WbPiCwB9MDnXxqlidUBbwQxNP2geg

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PhoneGap. And read it and created my work. http://docs.phonegap.com/en/1.9.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android And i added
I'm writing an iOS application using PhoneGap (aka Cordova), I have a simple html
I am new to phonegap. I am using phonegap with IOS. the problem i
I'm building an application for iPhone(iOS 5) using Phonegap(Html + Javascript + Css), and
I have an app made using jquerymobile+phonegap, and running under iOS. The surpise arrived
I am writing a iphone application using phonegap and ios. I have a weird
I currently have a app created using PhoneGap running solely on IOS, with future
I have a simple html login form, deployed on Xcode using phonegap framework. When
I'm developing a native mobile app for Android and iOS using PhoneGap.I have a
I am using phonegap(cordova 2.1.0) for IOS/android app development. Every time i have to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.