First, why use the block callback in some third-party SDK does not need to use weakself, for example AFN
AFN in the package, rewrite the setCompletionblock method, after the callback directly to the Completionblock to nil, breaking the circular reference
Second, why should block use Copy to modify
By default, the block is archived in the stack, the scope is reclaimed, and then the call is crash, and the copy operation allows it to keep a copy in the heap, guaranteeing access.
Iii. What is the message push process, Devicetoken?
1, application via method
-(void) Registerusernotificationsettings: (uiusernotificationsettings *) notificationsettings NS_AVAILABLE_IOS (8_0) __TVOS_
prohibited;
Registering remote notifications
2, via proxy method
-(void) Application: (uiapplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) DeviceToken { get Devicetoken from APNs
3, The application submits devicetoken to the service end
5, APNs in the iphone list of its registered push service, looks for an iphone with the appropriate identity and sends the message to the iphone.
6, iphone sends messages to the appropriate application, and pops up push notifications as set.
Iv. Why we do not need to manually control the reference count under Arc
1, the compiler will automatically insert the appropriate retain, release, autorelease statement in the appropriate place
2. These statements are added during compilation, not at runtime
V. Verification process of HTTPS protocol
1. Client initiates HTTPS request
2, server configuration certificate, obtain the private key and public key
3, the service side will pass the certificate to the client
4, the client verifies that the certificate is valid, if valid, use this certificate to encrypt a set of values
5. The client passes the confidential random value to the server
6, the service side through the private key decryption, get the immediate value
7, the server will return the content by this value is encrypted and passed to the client
8. The client receives the encrypted data and decrypts the data using the previously generated random value
Vi. the relationship between threads and Runloop,autoreleasepool
1. Runloop is used to manage threads, andrun loop puts its thread into hibernation when there is no event handling ; only the runloop of the main thread is turned on by default
2, for each runloop, the system will implicitly create a autorelease pool, so that all the release pool will constitute a callstack like a stack structure, At the end of each runloop, the Autorelease pool at the top of the current stack is destroyed so that each object in the pool will be release.
iOS interview notes (2)