NJCS: A Lightweight Dynamic Deployment Solution for iOS Apps – Usage Guide
This article introduces NJCS, a lightweight dynamic deployment framework for iOS that enables rapid feature updates without App Store re‑approval, explains its background, integration steps, page creation, navigation APIs, UI component usage, notification handling, and provides practical code examples for developers.
Background iOS app review cycles can delay feature optimization; dynamic deployment solutions like NJCS allow rapid updates without re‑submission.
NJCS Deployment Effect The framework has been applied to many pages (e.g., smart chat, privilege purchase, coupon usage) with complex UI interactions, demonstrating its feasibility for large‑scale apps.
How to Quickly Get Started
1. Project Integration After app launch, set up exception handling, JS file directory, data type adapters, and custom extensions.
[NJCS setExceptionHandler:^(NSDictionary *exceptions) {}];
2. Set JS Files Directory
[NJCS sync:njcsFilesRootURL];
3. Register Data Type Adapters for CGRect, CGPoint, CGSize, UIColor, UIFont, etc.
[NJCS registerModelAdapterForType:[ModelTypeClass]];
4. Add Custom Extensions such as HTTP interfaces.
[NJCS addHttpInterface:CommonTool];
Page Class Implementation Create a JSViewController by defining the class name and lifecycle methods; the first line must contain //FORMATTAG for preprocessing.
Page Navigation APIs
Push a JS page:
- (void)pushTargetViewController:(NSString *)jsFile data:(id)data animated:(BOOL)flag;
Push a native page:
- (void)pushViewController:(NSString *)className data:(id)data animated:(BOOL)flag;
Pop current view controller:
- (void)popViewControllerAnimated:(BOOL)flag;
Other navigation methods include popToTargetViewController, popToViewController, presentTargetViewController, presentViewController, and dismissViewController, each with appropriate parameters for data and animation.
Common UI Component Usage NJCS wraps standard UIKit components (UILabel, UIButton, UITableView, etc.). Load components into the JS context before use, and use IMPORT_CLASS(NativeClassName) to avoid duplicate loading.
Example of loading a component:
IMPORT_CLASS(NJCSUILabel);
Notification Usage NJCS provides three APIs for posting, adding, and removing notifications, usable from both JS and native sides.
Example:
[NJCS postNotificationName:@"MyNotification" object:nil];
Conclusion Mastering the five core areas—project integration, page implementation, navigation, UI components, and notifications—enables iOS developers to adopt NJCS quickly and efficiently for dynamic feature deployment.
58 Tech
Official tech channel of 58, a platform for tech innovation, sharing, and communication.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.