WHAT IS THE RESPONDER CHAIN?
Answer: To handle user interaction with UI and external events in iOS, the mechanism of the Responder Chain is used.
For touch events:
An object of type UIWindowstries to pass a touch to the object of the type UIViewin which it was called (hit-testing)
If UIViewthis touch cannot be processed (for example, the object is currently invisible, or disabled the ability to interact with itself), touch is transmitted to the superview of this component, and so on up until it is processed
Class UIApplication, UIViewControllerand UIViewinherited from the class UIResponder.
The class UIResponderdefines the order in which objects handle events (touch events, events from UI elements (buttons, etc.), text change). In addition, it UIResponderdeclares methods that allow objects to determine who will be the first to respond and process messages:
becomeFirstResponder – the recipient object of the message will be the first to receive all the events sent by the system
resignFirstResponder – the recipient object refuses to process messages first
HOW DO PUSH NOTIFICATIONS WORK?
Answer: Push notification is a short message consisting of a token of a device, payload, and some other information. The payload is the actual data that will be sent to the device. The scheme of work is as follows:
The Apple Push Notification Service (APNS) requests a token from the device, a kind of key that can be considered an “address”.
There is a server (our or another service).
The application sends a token to the server, which is busy sending push notifications.
When there is an event for your application, the server will send a push notification to APNS.
APNS will send a push notification to the user’s device.
To develop push notifications, the following points should be considered:
iPhone, iPad or iPod touch. Push notifications do not work in the simulator, so you need a real device for testing.
Registration in the iOS Developer Program. For each application in which the Push Notifications mechanism will be integrated, you must create a new App ID and provisioning profile, as well as an SSL certificate for the server. These actions are performed on the iOS Provisioning Portal.
You must create a provisioning profile and an SSL certificate.
A server connected to the Internet. The server always sends push notifications.
Push notifications are something quite small; The size of the payload cannot exceed 256 bytes. This is about the same as allowing you to place an SMS or a tweet. The push server will not be spent online breaks and spaces.
Thin moments when working with push notifications:
They are not reliable! There is no guarantee that push notifications will be delivered even if APNS accepts them.
Once your server has generated a push notification, it sends it unanswered to APNS. There is no way to know the delivery status of the notification to the end user after sending. Delivery time can vary from a few seconds to half an hour.
In addition, i-delay users may not be able to receive push notifications all the time. For example, near there is no Wi-Fi network with Internet access or the device can be turned off at all.
APNS will attempt to deliver the last notification sent when the device becomes available for reception. But these attempts are limited in time. After a timeout, the push notification will be lost forever!
They can be expensive! Add push-functionality to the application is quite simple and inexpensive if you own the data. However, if you have many users, or you need to request data, the costs increase dramatically.
WHAT ARE SOLID PRINCIPLES?
S – Single responsibility principle – The principle of a single duty: Each class must be assigned a single responsibility.
O – Open/closed principle – The principle of openness/closure: Software entities must be open for expansion, but not closed for modification.
L – Liskov substitution principle – The functions that use the base type must be able to use subtypes of the base type without knowing it.
I – Interface segregation principle – Many interfaces are better than one universal interface.
D – Dependency inversion principle – Dependency inversion principle: Dependencies within the system are built by abstractions. The top-level modules do not depend on the lower-level modules. Abstractions should not depend on details. Details should depend on abstractions.
WHAT IS THE LIFE CYCLE OF THE IOS APPLICATION?
Answer: Application states
|Not running||The application was not started or was started, but its execution was interrupted by the system|
|Inactive||The application is running in the foreground, but at the moment it does not accept events. (Although it can execute some other code at this time). The application usually stays in this state for a very short time, since it immediately goes into another state.|
|Active||The application works in the foreground and receives events. This is the normal mode for applications in the foreground.|
|Background||The application is in the background and executes the code. Most applications enter this state for a short while, during the transition to the suspended state. However, an application that requests additional runtime may remain in this state for a while. In addition, an application that runs directly in the background immediately enters the Background state, not the Inactive state.|
|Suspended||The application is in the background but does not execute the code. The system automatically translates applications into this state and does not notify them of this. The application is suspended, it remains in memory, but does not execute any code. When a low memory state occurs, the system can delete paused applications without notification to make room for the foreground applications.|