{ tech }

  • How to Check If Color String Valid

    | /

    We have a project based on ReactNative. Recently, we encountered a problem, that is, when the operation colleague configured the color value, one was missing, and only five were allocated, which led to page confusion and JS errors.

    In addition to increasing restrictions on the configuration platform, we have also taken some inspection measures in the project.

    The problem is, how to check if the color string is valid using JS.

  • Why Should Take "What's New" Seriously

    | /

    For personal APP, it may pay more attention to the writing of “What’s New” to attract more users to download and upgrade.

    If you work for a large company, the content source might be a product manager or operations.

    So how to write What’s New better? We often see some novel serialization or small humor, which is very interesting.

    But in any case, I advise everyone to show your artistic talents on the basis of writing real and updated content.

    Because we have been rejected for violating the "Performance - Accurate Metadata" clause.

  • Why State update doesn't work

    | /

    Recently, some personal apps have begun to try to use SwiftUI.

    Although some simple layouts, SwiftUI is indeed very efficient in development. But in actual development, many problems will be encountered.

    1. The development concept is different from UIKit, which leads to unaccustomed.
    2. Some components only have UIKit and need to be encapsulated.
    3. There will be compatibility issues with different versions of Xcode and operating systems.
    4. Sometimes some writing methods lead to actual effects that do not meet expectations.
    5. And so on.

    I have encountered a situation where the State change does not take effect, and it is also possible that my usage is not completely correct.

  • Quick Fix For Can't add self as subview

    | /

    I believe you can always find a lot of this kind of Crash: Can't add self as subview.

    We also know that we will never write code like add self as subview.

    In fact, in most cases, the push and pop pages with animation and no animation occur at the same time.

    Because we all know that this is often caused by the complexity of the page hierarchy and the unpredictable page jumps. So often choose to shelve this Crash helplessly.

    But we always think about how to eliminate this Crash. Whether it is from the perspective of user experience or from the aspect of Crash rate management.

  • Quickly build VPN from VPS

    | /

    We use VPNs a lot these days, both on a business and personal level.

    As a company, in order to facilitate employees to work remotely, they often provide VPNs based on commercial companies such as Cisco. As an individual, for convenience, most scenarios may also choose a mature third-party VPN provider.

    But sometimes we may already have our own VPS, or a third-party VPN cannot meet our demands in some aspects. At this time, it is also a common choice to build a VPN based on VPS. Of course, there are also many people who simply feel that they are happier with their own hands. XD

  • Extension Version Mismatch

    | /

    When we need to intercept the pushed information and customize the display, we need to use the extension capabilities provided by Apple. It means that our project will become a multi-target project.

    At this time, we may encounter the problem of version mismatch.

  • Preprocessor Macros in Pods

    | /

    As mentioned earlier, we can inject macros into Pods from the outside by modifying the Podfile. You can refer to this article Inject TEST macros into Pods.

    Sometimes there are some macros that are expected to be used inside the Pods library we wrote ourselves.

    A common practice, just like ordinary business code, define a macro definition header file, and then import.

    But sometimes there are such scenarios, such as logging or providing some externally exposed APIs, you need to provide the version of the current library.

  • Inject TEST macros into Pods

    | /

    When we develop iOS applications, we often use CocoaPods for third-party library management.

    In addition to external third-party libraries, it is common for CocoaPods to be used as a library management tool for individuals or companies.

    We usually use macros such as DEBUG for environment-sensitive branch compilation.

    CocoaPods provides DEBUG macro injection by default to facilitate our local debugging.

    However, in actual development projects, in addition to using the DEBUG macro to identify local debugging, macros such as TEST or QA are also used to identify the test build package.

    At this time, we expect that the library in Pods can also inject TEST macros on demand.

  • weakSelf in dealloc

    | /

    We all know that it is generally recommended to do simple cleanup in the dealloc method.

    A very important reason is that in the process of destroying an object, if an operation such as weak is performed, it will cause a crash.