iOS Network programming--day1

Source: Internet
Author: User
Tags get ip

1. Binary, decimal, octal, 16 binary conversion

2. Framework, the development tool itself provides a class package for implementing a specific function

Xcode Common Framework--uikit,foundation,coredata

3. Introduction of third-party class libraries
iOS SDK is relatively low-level, the developer work relatively large, third-party class library is written by other programmers open source code, can be copied directly to their own programs to use, thus simplifying development work, iOS can support a large number of third-party development

    • three20– common framework such as Photo Viewer

    • Sharekit-Open source framework for sharing

    • Restkit–http access to the open source framework

    • Afnetworking-Network communication class library, used to obtain network data, simple implementation of POST request to obtain third-party

    • ASIHTTPRequest is used to obtain network data, to implement breakpoint continuation, cache, download progress display

    • FMDB Simple implementation of sqlite3 third party, used to operate sqlite3, simple encapsulation

    • Gdataxml third-party parsing of XML data using DOM methods

    • Jsonkit,sbjson two third-party for parsing JSON data

    • mbprogresshud– Progress indicator Class library, pop-up view third party, can display wait indicator, warning box

    • Mjrefresh table, grid pull-up load more, drop-down refreshed third party

    • REACHABILITY3.0 determines whether the network connection of the third party is networked, is 2g. 3g. 4g Network, Broken network

    • sdwebimage– simplifies the network image processing of the class library, loading the network picture of the third party, can be cached, two reads do not walk the network and go cache, make the page effect smoother

4. Developing Memory:

(1) Data area: Constants (literal constants, const,const pointers), global variables, static variables (statics), enumeration variables

(2) Code area: program source code

(3) Stack area: General variables, function parameters, automatic partition of memory, automatic recovery

(4) Heap area: Dynamically applied Memory (malloc, New, alloc), programmer allocates memory, programmer recycles

5. Workaround for third-party classes that do not support arc

(1) Turn the whole project into MRC

Project->build Settings->cmd+f->arc, change Yes to No

(2) Turn the class you want to use into MRC (this file does not use OCARC)

->build phases, Compile, Sources, the class you want to change, double-click empty space, fill in "-fno-objc-arc"

6. How to add a third-party file

(1) Copy the third-party file you want to import, paste it into the project directory, and open xcode-> right-click Add files to...-> to find the pasted third-party file->add

(2) Use drag and drop files directly to the project, tick copy-> tick Create->add

1 Creating a group (* * * folder)

2 Adding a subfolder (a blue folder)

7. Note When importing files, see if support for importing library files is required, such as using reachability to import the Systemconfigation.framework library, because the Scnetworkreachability class in the framework is used

8. If you need to remove the system frame, you can only select Remove Reference, delete the reference

9. Domain name is the wrapped IP address, better remember to use ping domain name can get IP address

10.id differs from Instancetype:

(1) ID denotes any object type

(2) instancetype indicates that only this class of object type can be returned

11. Using a third party can simply implement the function, the disadvantage is that the bug is not adjustable


12.Reachability method for detecting network status
Detect site Connection: [reachability reachabilitywithhostname:**];
Detect WiFi connection: [reachability Reachabilityforlocalwifi];
Detect Internet connection: [reachability reachabilityforinternetconnection];
13. How to adjust the test results:-currentreachabilitystatus
14. Enumeration value meaning of network detection results
Notreachable: Cannot connect
Reachableviawwan: Using 3G/4G network connection
Reachableviawifi: Using WiFi network connection
15. Use Reachability to monitor network status changes
Registering a notification with the notification hub named Kreachabilitychangednotification
Create a Reachability object and call the-startnotifier method to turn on the listening state
Custom method, monitor the network status changes to do the corresponding operation

iOS Network programming--day1

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.