Method for realizing file uploading in iOS application
By using WeChat or enterprise WeChat to share files into the sandbox directory in iOS applications and uploading files in combination with network environment judgment, the problem of inconvenient file upload operation in iOS applications is solved, and a user-friendly and develop-friendly file upload solution is realized.
Patent Information
- Application Number
- CN202411222524.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-27
AI Technical Summary
File upload operation in iOS applications is inconvenient, especially because the sandbox mechanism restricts users from directly accessing stored files, and existing methods such as installing File App or developing WeChat applets have problems such as high development costs and poor user experience.
By sharing files on WeChat or enterprise WeChat to the sandbox directory of iOS applications, visual preview, selection and upload of files is realized, and file upload operations are combined with network environment judgment (WIFI or mobile data), which simplifies user operation process and reduces Development complexity.
It realizes a user-friendly file upload experience, simplifies operational processes, reduces development costs, and facilitates troubleshooting when file transfer fails, and supports file preview and deletion operations.
Smart Images

Figure CN119211220A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file uploading, and in particular to a method for implementing file uploading in an iOS application. Background Art
[0002] With the popularization of mobile Internet, more and more work scenes are transferred to mobile devices. iOS, as a mobile operating system developed by Apple, has been loved by a large number of users for its excellent user experience and security. The function of uploading files in iOS applications is of great significance to improving user experience and meeting user needs.
[0003] Currently, there are two ways to upload files in iOS applications:
[0004] Method 1: Upload files through Apple's third-party File App: First, you need to install the File App on your phone. The files to be uploaded need to be saved in the File App first. The ability to call the File App is integrated in the current App. When using the file upload function, call the system API to open the File App, obtain the file data to be uploaded from the File App, and upload the obtained file data to the server in the current application.
[0005] Method 2: Call the WeChat applet and access the files that need to be uploaded in the WeChat conversation through the WeChat applet: First, you need to develop the WeChat applet and connect the identity information with the current application. When using the upload function, first call the developed WeChat applet in the current application, so as to further access the files sent in the WeChat chat and upload them.
[0006] However, in the above method 1, the File App needs to be installed on the mobile phone, which is not friendly to users who do not often use the App and have small device storage space. In addition, the File App can access not only all files under the current App sandbox file but also files under other App sandboxes. It takes a long time for users to find files to upload, and it is easy to upload the wrong file by mistake.
[0007] In the second method, you need to develop a WeChat applet first. For companies that have no demand for the applet but only need to upload files, the development cost is too high, and more development resources need to be invested. In addition, only files transmitted through WeChat can be uploaded, and files transmitted through other methods, such as corporate WeChat, cannot be accessed. At the same time, because the link from calling the file upload to the actual file upload is too long, it is difficult to troubleshoot when the upload function fails.
[0008] That is, due to the security restrictions of the iOS operating system sandbox mechanism, users cannot directly access the files stored in the current App through the visual file directory and perform file upload operations. Summary of the invention
[0009] The technical problem to be solved by the present invention is to overcome the defect that the operation of file uploading in iOS applications in the prior art is relatively inconvenient, and to provide a method for implementing file uploading in iOS applications.
[0010] The present invention solves the above technical problems through the following technical solutions:
[0011] The present invention provides a method for implementing file uploading in an iOS application, and the uploading method includes the following steps:
[0012] Step 1: Share the file to be uploaded to the current application;
[0013] Step 2. Click to preview the shared file;
[0014] Step 3. Select the file to upload;
[0015] Step 4: Determine whether you are currently in a WIFI environment. If yes, proceed directly to step 7. If not, proceed to step 5.
[0016] Step 5: Prompt the user;
[0017] Step 6: Determine whether to continue uploading. If yes, proceed to step 7. If no, proceed directly to step 8.
[0018] Step 7. Upload files;
[0019] Step 7: Prompt the user whether the upload is successful;
[0020] Step 8: End uploading.
[0021] In this technical solution, users can share the files they need to upload through a third-party WeChat or enterprise WeChat to save them in the specified directory of the sandbox of the current App, and users can preview and delete local files as needed.
[0022] Preferably, the specific operation steps of step 1 are:
[0023] S1. File transfer: users first transfer the files to be uploaded through the commonly used WeChat or enterprise WeChat;
[0024] S2. File sharing: Use the sharing function in WeChat or WeChat for Business to share files to the current application and store them in the specified sandbox directory.
[0025] In this technical solution, confirm the specific operation steps of step one.
[0026] Preferably, in step three, the user can upload or delete the file.
[0027] In this technical solution, the specific function of step three is confirmed.
[0028] Preferably, in step three, the user can select a single file or multiple files to upload.
[0029] In this technical solution, in step three, the number of uploaded files can be selected.
[0030] Preferably, in the step S2, sandbox is a computer professional term and a security mechanism in the field of computer security, which provides an isolated environment for running programs. The sandbox runs the software in a restricted system environment and controls the resources available to the program.
[0031] In this technical solution, the sandbox is explained.
[0032] Preferably, the sandbox directory in step S2 refers to the system sandbox of the iOS application. The sandbox mechanism of the iOS system stipulates that each application can only access files under the current sandbox directory.
[0033] In this technical solution, the sandbox directory is explained.
[0034] Preferably, in step 4, determining whether the current environment is a WIFI environment is determining the network connection status.
[0035] Preferably, the network connection status is divided into WIFI connection and mobile data traffic connection.
[0036] In this technical solution, the classification of network connection status is confirmed.
[0037] Preferably, the WIFI connection is a wireless network connection method based on wireless local area network technology, which transmits Internet signals to the device through a wireless router, so that the device can wirelessly connect to the Internet within a certain range.
[0038] In this technical solution, the definition of WIFI connection is confirmed.
[0039] Preferably, the mobile data traffic connection refers to the amount of data transmitted through a mobile network (such as 2G, 3G, 4G, 5G), and the mobile data traffic determines the amount of data that a user can download, upload and browse on the mobile network.
[0040] In this technical solution, the definition of mobile data traffic connection is confirmed.
[0041] On the basis of being in accordance with the common sense in the art, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present invention.
[0042] The positive and progressive effects of the present invention are:
[0043] The user of the present invention is simple and convenient to use. The user only needs to share the file to the current application, and use the upload function in the file upload place to read the file to be uploaded from the sandbox directory and display it to the user on a visual page. The user does not need to care about other things, and the interface is friendly and the operation is friendly;
[0044] The files to be uploaded can be shared from the commonly used WeChat and enterprise WeChat to the current application, which is easy for users to accept;
[0045] When a file transfer fails, you only need to troubleshoot in the current application, which is developer-friendly.
[0046] The visual file preview page supports file preview and deletion, and is user-friendly. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 The present invention is a schematic diagram of the overall process of implementing a file upload method in an iOS application according to an embodiment of the present invention.
[0048] Figure 2 for Figure 1 The flowchart of step 1 of the method for uploading files in the iOS application shown is shown. DETAILED DESCRIPTION
[0049] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0050] Figure 1 and Figure 2 The schematic diagram of the structure of an embodiment of the method for uploading files in an iOS application of the present invention is shown. The method for uploading files in an iOS application includes the following steps:
[0051] Step 1: Share the file to be uploaded to the current application;
[0052] Step 2. Click to preview the shared file;
[0053] Step 3. Select the file to upload;
[0054] Step 4: Determine whether you are currently in a WIFI environment. If yes, proceed directly to step 7. If not, proceed to step 5.
[0055] Step 5: Prompt the user;
[0056] Step 6: Determine whether to continue uploading. If yes, proceed to step 7. If no, proceed directly to step 8.
[0057] Step 7. Upload files;
[0058] Step 7: Prompt the user whether the upload is successful;
[0059] Step 8: End uploading.
[0060] In this technical solution, users can share the files they need to upload through a third-party WeChat or enterprise WeChat to save them in the specified directory of the sandbox of the current App, and users can preview and delete local files as needed.
[0061] When using it, first share the file to be uploaded to the sandbox of the current application and save it. When the user uploads, the file stored in the sandbox is read first and displayed to the user in a visual way. The user can select one or more of the current files to upload. When uploading files, the current network environment will be monitored. If it is WIFI, it will be uploaded directly. If it is 4G / 5G, the user will be prompted and the user will choose whether to continue uploading.
[0062] The specific operation steps of step one are:
[0063] S1. File transfer: users first transfer the files to be uploaded through the commonly used WeChat or enterprise WeChat;
[0064] S2. File sharing: Use the sharing function in WeChat or WeChat for Business to share files to the current application and store them in the specified sandbox directory.
[0065] In this technical solution, confirm the specific operation steps of step one.
[0066] In step three, the user can upload or delete the file.
[0067] In this technical solution, the specific function of step three is confirmed.
[0068] In step three, the user can select a single file or multiple files to upload.
[0069] In this technical solution, in step three, the number of uploaded files can be selected.
[0070] In the step S2, sandbox is a computer professional term and a security mechanism in the field of computer security. It provides an isolated environment for running programs. The sandbox runs the software in a restricted system environment and controls the resources available to the program.
[0071] In this technical solution, the sandbox is explained.
[0072] The sandbox directory in step S2 refers to the system sandbox of the iOS application. The sandbox mechanism of the iOS system stipulates that each application can only access files under the current sandbox directory.
[0073] In this technical solution, the sandbox directory is explained.
[0074] iOS sandbox is an important security mechanism in the iOS operating system, which provides each application with an independent and isolated file system environment.
[0075] Each iOS application has its own sandbox, which is an independent file system directory that is completely isolated from the file systems of other applications. This isolation ensures that the data and code of the application cannot be directly accessed or modified by other applications, thereby improving the security of the system.
[0076] In the step 4, whether the current environment is a WIFI environment is determined, that is, the network connection status is determined.
[0077] The network connection status is divided into WIFI connection and mobile data traffic connection.
[0078] In this technical solution, the classification of network connection status is confirmed.
[0079] The WIFI connection is a wireless network connection method based on wireless local area network technology. The Internet signal is transmitted to the device through a wireless router, so that the device can wirelessly connect to the Internet within a certain range.
[0080] WIFI is widely used in homes, offices, shopping malls, etc., providing users with high-speed and stable network connections and supporting multiple devices to access the Internet at the same time. Compared with mobile data traffic, WIFI usually has a larger bandwidth and lower latency, but is generally free.
[0081] In this technical solution, the definition of WIFI connection is confirmed.
[0082] The mobile data traffic connection refers to the amount of data transmitted through a mobile network (such as 2G, 3G, 4G, 5G). Mobile data traffic determines the amount of data that a user can download, upload, and browse on a mobile network.
[0083] The unit of traffic is usually "MB" (megabyte) or "GB" (gigabyte). Users can purchase traffic of different packages to meet their data needs on the mobile network. The price of the package and the amount of available traffic vary by operator and region.
[0084] In this technical solution, the definition of mobile data traffic connection is confirmed.
[0085] The specific implementation process is that the user first transfers the files to be uploaded through the commonly used WeChat or enterprise WeChat method, and uses the sharing function in WeChat or enterprise WeChat to share the files to the current application and store them in the specified sandbox directory. When the user calls the upload function, the shared files are read from the sandbox directory and all the files that can be uploaded are displayed to the user on a visual page. The user can choose to upload one or more files, or preview or delete the current file. When uploading files, the current network environment will be detected. When using WIFI, it will be uploaded directly. When using traffic, the user will be prompted whether to continue uploading, and the user will be prompted whether the file upload is successful.
[0086] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. Implementing a file upload method in an iOS application, characterized by: The uploading method comprises the following steps: Step 1: Share the file to be uploaded to the current application; Step 2. Click to preview the shared file; Step 3. Select the file to upload; Step 4: Determine whether you are currently in a WIFI environment. If yes, proceed directly to step 7. If not, proceed to step 5. Step 5: Prompt the user; Step 6: Determine whether to continue uploading. If yes, proceed to step 7. If no, proceed directly to step 8. Step 7: Upload files; Step 7: Prompt the user whether the upload is successful; Step 8: End uploading.
2. The method for implementing file upload in an iOS application as claimed in claim 1, characterized in that: The specific operation steps of step one are: S1. File transfer: users first transfer the files to be uploaded through the commonly used WeChat or enterprise WeChat; S2. File sharing: Use the sharing function in WeChat or WeChat for Business to share files to the current application and store them in the specified sandbox directory.
3. The method for implementing file upload in an iOS application as claimed in claim 1, characterized in that: In step three, the user can upload or delete the file.
4. The method for implementing file upload in an iOS application as claimed in claim 1, characterized in that: In step three, the user can select a single file or multiple files to upload.
5. The method for implementing file upload in an iOS application as claimed in claim 2, characterized in that: In the step S2, sandbox is a computer professional term and a security mechanism in the field of computer security. It provides an isolated environment for running programs. The sandbox runs the software in a restricted system environment and controls the resources available to the program.
6. The method for implementing file upload in an iOS application as claimed in claim 2, characterized in that: The sandbox directory in step S2 refers to the system sandbox of the iOS application. The sandbox mechanism of the iOS system stipulates that each application can only access files under the current sandbox directory.
7. The method for implementing file upload in an iOS application as claimed in claim 1, characterized in that: In the step 4, whether the current environment is a WIFI environment is determined, that is, the network connection status is determined.
8. The method for implementing file upload in an iOS application as claimed in claim 7, characterized in that: The network connection status is divided into WIFI connection and mobile data traffic connection.
9. The method for implementing file upload in an iOS application as claimed in claim 7, characterized in that: The WIFI connection is a wireless network connection method based on wireless local area network technology. The Internet signal is transmitted to the device through a wireless router, so that the device can wirelessly connect to the Internet within a certain range.
10. The method for implementing file upload in an iOS application as claimed in claim 7, characterized in that: The mobile data traffic connection refers to the amount of data transmitted through a mobile network (such as 2G, 3G, 4G, 5G). Mobile data traffic determines the amount of data that a user can download, upload, and browse on a mobile network.
