iOS Development--mac Server Setup

Source: Internet
Author: User

Objective

For the understanding of Mac computers, I have been stuck in the consciousness of the B artifact, just two days ago I completely changed the vulgar view, was busy writing graduation design, suffering from iOS development no server,
Data are from the Web crawl or local plist file, feel not big enough, graduation design how mediocre, so prepare to Daoteng under the server development, to meet my bi (outfit) industry (B) wish.

Preparation Phase 1. Mac computer One 2. Simple php or TSP or C # (some fur can simply write points) 3. Unix/linux Terminal command start 1. Start Server Apache (why Apache?) Free, open source) Our Mac is a great development tool, the default has been installed Apache, Python environment, etc., open the terminal, enter sudo apachectl -k start, (May let you enter your computer's password during operation) so the Apache server opens 2. Open the browser and enter localhost or 127.0.0.1 in the address bar

If the following page appears to indicate a successful start

3. Are you sure you doubt that now? Why is it works! displayed , which is the default directory display status for Apache. We build our own server to modify the contents of the default directory or to modify the directory directly. 4. In Terminal input: cd /etc/apache2/Enter Apache inside, as a system-level service identity sudo vim httpd.conf, open the Httpd.conf profile 5. Find the DocumentRoot string and modify it

As shown, this is the default Apache server directory, press i key to modify, modify the address inside the directory can be re-operation of the server.

    DocumentRoot "/Users/wangxinxin/Sites"
Note that there are three changes that need to be made, as shown in


After the modification is complete, press Esc, and then shift+: Enter wq, save to exit the current file (linux Basic command, do not understand Google a bit) 6. Reboot Apache Server sudo apachectl -k restart7. We specify the server folder to sites this file, in this folder put a picture called 001.jpg, in the browser input localhost/001.jpg, if the access to the server has been set up 8. Close Apache server: sudo apachectl -k stopDo a simple demo test to create a new project----Main.storyboard inside drag a uiimageview and a UIButton, when the button is clicked, request the picture from the server to load into the Uiimageview. The core code is as follows:
- (IBAction)severImageBtn:(id)sender {NSURL *url=[NSURL URLWithString: @"http://127.0.0.1/001.jpg"];NSData *data=[NSData dataWithContentsOfURL:url];self.imageView.image=[UIImage imageWithData:data];}
Effect Show:

iOS Development--mac Server Setup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.