Recently, I am busy working on a file transfer software. At the beginning, I didn't want to think about the difficulty of project implementation. It is not feasible. How can this problem be solved? Because similar software has already been launched, and others have already implemented it. Even more analysis on the feasibility is unnecessary. This project is also the first project after I changed my job. It was not very long before I started ios development, and I have limited experience in ios development. I have never thought about any difficulties. I just want to settle on it.
After the project is divided, I am arranged to work on audio and video modules and image modules, mainly for obtaining and playing UI and media files. It seems that there are not many things. I took my previous work thinking, got my needs, found a solution, considered the work cycle, planned work workload, and did it with respect. In general, my approach is to first find a solution for uncertain problems. If these solutions are available, the work will not feel the pressure, just the workload. After reading the requirements, I first went to find out how to obtain files in the ipod and their basic attributes, such as music files, their album names, singers, and covers. At that time, I found a blog on getting basic information about the ipod music file in the blog Park. I was excited to read it, and I also posted it to my blog so that I could read it at any time, in my blog, I called "ios getting music library information (transfer)". I didn't read the original text either, so I don't know where the original text is, I just added a "Turn" Word to the title to form a non-self-published book. Then I followed this article to complete the operations in the ipod, play music, music list, cover of music files, and artist. In fact, it is not very difficult to just do this, because you only need to use MPMediaQuery to get all the music files in the ipod, and then loop his items to get each music file object, according to the valueForProperty of the music file object: The method can get what you want. Novel: not all you want can be obtained. Because of this, I encountered some problems, which are also the most difficult and difficult to solve in this project. Also began to understand the basic principles of the ios system. At the beginning of the article, I started to use a file transfer software, so it is not just to transfer files in my own program. Since we need to mention ipod, it also means that you need to perform operations on files in the ipod, such as playback and transmission. I think: ios developers all know that ios is relatively closed, which is also the high security of the system. Based on the sandbox principle, he wants to operate on files of other programs. It is not an interface provided by the system. You cannot implement what you want. At that time, I had been confused about how to export ipod files. I checked a lot of information, posted many posts, and asked some colleagues, but they did not solve the problem. So this problem also dragged on for a long time. The problem is not mainly about how to export data, but about how to export data to other platforms, such as android. This is the format of the file. In ios systems, the files exported by the provided interfaces are basically in the format of m4a and caf. These formats cannot be played on the android system. So if you want to play in other systems, you can only play in mp3 format. If you want to export files in mp3 format, I think many people want this requirement. This is what I have seen on many posts, however, basically no one can deploy this solution in mp3 format in detail. Later, I can use the lame Library mentioned on the Internet to export the files in the ipod to the caf format, and then convert them to the mp3 format through the lame library. I tried and succeeded. I was excited, but the export results were unsatisfactory. There are two of the most serious disadvantages: one is that the conversion time is relatively long, and it takes a minute to convert a 10 M file. I think: for a file transfer software, this reality cannot be accepted; second, after the conversion, the sound quality changes to the bottom, and the file size also decreases significantly. I think this is a problem with the mp3 format. mp3 itself is lossy conversion. I am desperate to solve this problem. But how does other software solve this problem? I don't know how to convince myself. Do other people convert their own formats? I still spent money to get an interface for Apple to export mp3 files directly? I cannot confirm these confusions. Suddenly felt desperate. I also started to shift my attention and started other projects. Soon after other projects, I finally saw hope. A colleague found a demo on the Internet and exported the mp3 file within one second. It's amazing. I was surprised and excited. Without the loss of sound quality, the file size remains unchanged, but some basic elements, such as the album art and artist attributes, are still lost. To ensure that attributes are not lost, you have to add these attributes by yourself. I think we have done better, and exporting mp3 files is really exciting. Let's not look at these small issues first.
After exporting mp3 files, the problem is solved. I feel a lot better. If you have a friend who needs this, I can send a demo.