iOS development--mac under Server Setup

Source: Internet
Author: User

Objective

Knowledge of Mac computers. I have been stuck in the consciousness of pretending B artifact. Just two days ago I completely changed the vulgar view, was busy writing graduation design. Suffering from iOS development without server,
Data are from the Web crawl or local plist file, feel not big enough, graduation design how can ordinary, so prepare 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 be simple to write points can be) 3. The Unix/linux Terminal command starts at 1. Start Serverapache (Why Choose Apache?) Free, open source) Our Mac is a real development tool. The Apache, Python environment, and so on are already installed by default. Open the terminal. Input sudo apachectl -k start, (the password of the input computer may be allowed to operate) so the Apacheserver opens 2. Open the browser and enter localhost or 127.0.0.1 in the address bar

If the following page appears, the start is successful

3. Are you sure you doubt that now? Why it works is displayed. , which is the default folder display status for Apache.

We build our own server to change the contents of the default folder or change the folder directly. 4. In terminal input: cd /etc/apache2/ go inside Apache. As a system-level service sudo vim httpd.conf , open the httpd.conf configuration file 5. Find the DocumentRoot string and make changes

As the callout sees, this is the default Apacheserver folder. Press the I key to change, change the folder inside the address will be able to operate the server again.

    DocumentRoot "/Users/wangxinxin/Sites"
Note that there are three changes that need to be made together, such as the one seen


After the change 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. Start Again, Apacheserver. sudo apachectl -k restart7. We have designated the server folder to sites this file, in this folder put a picture called 001.jpg, in the browser input localhost/001.jpg, Assuming that the interview is complete, the server is set up 8. Close Apacheserver: sudo apachectl -k stopMake a simple demo test try a new project-> and drag a uiimageview and a uibutton inside the main.storyboard. When you click the button, request a picture from the server to load into 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 under Server Setup

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.