Summary of the first IOS APP

I have always wanted to make a few IOS games or applications, and I have been procrastinating again and again. I am a newcomer in the field of IOS APP, so it is most important to maintain awe and start small. I am very lazy, and the people around me are also very lazy. I want to automate everything, and it is best to only type a few lines of commands every day.
Summary of the first IOS APP

I didn’t think about what to do for a long time. I have a lot of needs. First of all, I like listening to audiobooks. Recently, there is a book shortage. , the update is slow, and I don’t want to read the text, so let’s just make an APP that reads the text directly, and the main functions are also arranged. , Bookmark history can not be less, there are only a few functions, only core functions, no UI, and finally after more than two weeks of development, debugging and debugging, the first version was completed. Even if it takes five weeks, because the apple developer annual fee requires a dual-currency credit card, I said at the beginning that I only need to re-apply for the first time to develop an IOS APP. Yes, so I applied for another one. It will take a few days for express delivery. The principle of my project time plan is to multiply the estimated time by 2. This parameter has saved my life several times.

I didn't do any documentation. The first step was to develop the core function, text-to-speech synthesis, commonly known as TTS. I first tried Baidu's speech synthesis, followed by iFLYTEK, and finally the one that comes with IOS. The effect is iFLYTEK's best. Well, Baidu is also very good and free. The worst thing is the speech synthesis that comes with IOS. In the end, after a fierce ideological struggle, I chose the speech synthesis that comes with IOS. The main reason is that I am lazy and don’t want to read third-party documents. With the debugging of the speech synthesis interface, the core functions of the entire APP are completed normally, and the confidence has been improved. The rest is nothing more than some server-side crawlers, database queries, APP-side interface business logic, etc., and so on. . .

What I consider is the data source. I am just a data porter, and crawler is essential. I selected two novel sites. The first site has more than 3,000 novels and 1.7 million texts. The server is Alibaba Cloud Hong Kong, the system is centos+nginx, which is the same as my own VPN. . . It seems that I underestimated the strength of Alibaba Cloud Server. The second site has nearly 4,000 novels and 700,000 texts. At first, I didn’t understand why there were so many novels on one site, but so many texts. Later, I found out that there were many new books. This server is in Los Angeles, and the system is windows+iis7.5, it is the same as my last VPN, it seems that I need to reconsider the VPN room. . . I simply tested it with python scrapy for a few hours. Alibaba Cloud's server would fetch 503 or 404 continuously. The Los Angeles server was a little slower, but it was very stable, and all 200. It was the exact opposite of what I thought. In the end, the Alibaba Cloud server did not respond. It took me a long time to recover); I finally chose the stable Los Angeles, this server has a simple anti-leech link, I just need to modify the User-Agent and Referer. After calculating the speed, I can catch 70,000 to 80,000 texts every day. It will take about eleven or two days to catch all of them. Fortunately, APP development only needs test data, so let the crawler continue to catch it. Here is an episode. In the end, I didn't use scrapy, and wrote a special crawler myself with asyncio+aiohttp+BeautifulSoup (lxml), because only the basic information of the novel, chapter list and text are needed, and it didn't take much time.

The mongodb used for the database, because asyncio concurrency quickly executes blocking calls directly in the coroutine, the whole system is almost dead, and a mistake is made here. The solution is to specially open a consumer thread to handle the operation of saving the database, and asyncio throws the data when it catches it. to the thread data queue. Since the network data acquisition time is definitely longer than the local saving time to the hard disk, it is reasonable to use the consumer mode to handle blocking operations, and it is also true.

I have designed four server-side APIs: query novel classification (such as fantasy, science fiction), query novel classification list (such as Shengxu, mortal cultivation biography), query single novel chapter list (such as the first chapter..., the second Chapter...) and the text of the query

Considering the final server production environment, what I want to use most is tcp socket, which has good security and performance. The bad thing is that it is not easy to debug this application without plaintext. Django is too big. A connection authentication API has been added, which is to generate a string of numbers for symmetric encryption on the server and client, which is better than plaintext. The algorithm is written by itself using multiplication and addition and subtraction. It is natural to understand, but if you come to catch me The library always takes some time, why bother? It's better to catch other unencrypted ones, the security is just right.

The APP side is developed synchronously, and most of the pits are caused by unfamiliar swift and no oc background. Fortunately, I skipped swift1, 2, and 3 and used 4 directly. I avoided the incompatible syntax problem. Well, it took two hours to make icons of various sizes and a launch interface background, the process is like this.

I can't submit the credit card before it arrives, because I have no experience in submission, so it is inevitable to encounter pitfalls, but I have reserved two weeks of time should be enough, after all, it is such a simple free application, God bless it smoothly.

Or upload a few preview images of the simulator, I hope to see you again!
Summary of the first IOS APP
Summary of the first IOS APP
Summary of the first IOS APP
Summary of the first IOS APP
Summary of the first IOS APP

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325163055&siteId=291194637