iOS development--Kinky skills Summary of various sexual techniques in the development of &ios (iii)

Source: Internet
Author: User

Summary of various kinky techniques in iOS development (III.)one: Send and awk explanations
    • Sed-n P filenamesed----------------------------is a stream editor
    • awk ' BEGIN {print ' Hellow '} ' awk--------is a programming language tool for working with text.
Two: Summary of the method of transmitting value
    • Kvo the bottom layer will dynamically Phoenix new class, only a strong attribute (the property of an object can back multiple redemption listening, an object can listen to the other properties of multiple objects)
      • KVC/KVO is based on runtime
    • Agent, specification, code: one-on-one
    • notification, send and receive: one-to-many (a notification can be accepted by multiple objects, an object can accept multiple notifications)
Three: block Simple summaryBloack pointer to struct, based on pointers and function pointers! The value can be changed after using __block outside, because the block has sent the address in

By default in the stack, a copy operation to the block can put it into the heap and use it consistently, and another way is block_copy (blockname) non-arc inside

Four: Swift code update: Turn 2.0Xcode 7 transforms the code into a tool for Swift 2. The tool is located under the Edit menu of Xcode--convert > to Latest Swift Syntax.

V: decode string using GTMBASE64 encoding

    • Gtmdefines.hgtmbase64.hgtmbase64.m
You can find these three files here (GTMDefines.h on the second page, click on the Next button in the upper right corner to jump to the second page)

Six: Codec function (can encode and decode strings, pictures, Video: filepath replaced by the corresponding):

Read the file from the emulator and the document path of the real machine, write the file after encoding, and decode it.

Cryptographic functions

1 -(void) Func_encodefile2 3 {4 5 //nsstring *path = [Nshomedirectory () stringbyappendingformat:@ "/documents/test.png"];6 7 nsstring *filepath = [Nshomedirectory () stringbyappendingformat:@ "/documents/iphone4.mov"];8 9     Ten  One //file path conversion to NSData A  - NSData *imagedataorigin = [NSData Datawithcontentsoffile:filepath]; -  the      -  - //For the first 1000 bits to be different or processed -  + unsigned char * cbyte = (unsigned char*) [imagedataorigin bytes]; -  +for (int index = 0; (Index<[Imagedataoriginlength]) && (Index < 1000); index++, cbyte++) A  at     { -  - *cbyte= (*cbyte)^ Arrayforencode[index]; -  -     } -  in //Base64 encoding for NSData -  to NSData *imagedataencode= [GTMBase64Encodedata:imagedataorigin]; +  - [Imagedataencode Writetofile:filepath atomically:yes]; the  * }

Decryption function

1 -(void) Func_decodefile2 3 {4 5 //nsstring *filepath = [Nshomedirectory () stringbyappendingformat:@ "/documents/test.png"];6 7 nsstring *filepath = [Nshomedirectory () stringbyappendingformat:@ "/documents/iphone4.mov"];8 9     Ten  One //Read data corresponding to the encrypted file A  - NSData *dataencoded = [NSData Datawithcontentsoffile:filepath]; -  the      -  - //Base64 decoding for NSData -  + NSData *datadecode = [GTMBase64 decodedata:dataencoded]; -  +      A  at //For the first 1000 bits to be different or processed -  - unsigned char * cbyte = (unsigned char*) [datadecode bytes]; -  -for (int index = 0; (Index<[Datadecodelength]) && (Index < 10); index++, cbyte++) -  in     { -  to *cbyte= (*cbyte)^ Arrayforencode[index]; +  -     } the  *      $ Panax Notoginseng [Datadecode Writetofile:filepath atomically:yes]; - } the  
Seven: Get each frame pushed by:
1 [Mimagegenerator generatecgimagesasynchronouslyfortimes:[nsarray arraywithobject:[nsvalue valueWithCMTime: Cmtimemakewithseconds (Time, Nsec_per_sec)] Completionhandler:2 ^ (Cmtime requestedtime, cgimageref image, Cmtime actualtime, avassetimagegeneratorresult result, Nserror *error) 3     {  4 NSLog (@ "Actual got image at Time:%f", Cmtimegetseconds (Actualtime)); if (image)5         {  6 [catransaction begin]; 7 [Catransaction Setdisableactions:yes]; 8 [layer setcontents: (ID) image]; 9    Ten //uiimage *img = [UIImage imagewithcgimage:image];  One //uiimagewritetosavedphotosalbum (img, self, nil, nil);  A     - [Catransaction commit];  -         }   the}];
Eight: iOS development and media knowledgeReal-time streaming media transmission must ensure that the transmission speed of the packet is greater than the speed of the file, or the user will see a video pause. Video quality degrades when the network is plugged, so it's better to ensure that the quality of the video is progressively downloaded.

Real-time Streaming media protocol:

    • RTSP (Real time streaming Protocol)
    • MMS (Microsoft Media Server Protocol)
    • HLS (Http Live streaming)

Here is the main introduction of HLS,

HLS (HTTP Live streaming) is an HTTP-based streaming solution developed by Apple for mobile devices such as the iphone, IPod, itouch and ipad Nine: m3u8 file conceptThe m3u8 file refers to the m3u file in the UTF-8 encoded format. The m3u file is an indexed plain text file that is opened when the playback software does not play it, but instead finds the corresponding audio and video file's network address for online playback based on its index.10: Swift in Autoclosure@autoclosure automatically package an expression into a closure (closure)

iOS development--Kinky skills Summary of various sexual techniques in the development of &ios (iii)

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.