Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Jun 24, 2021. It is now read-only.
/GroundControlPublic archive

Remote configuration for iOS

License

NotificationsYou must be signed in to change notification settings

mattt/GroundControl

Repository files navigation

Remote configuration for iOS

Note: This project is no longer being maintained.

Many developers don't realize that they are allowed to remotely control the behavior of their app (provided that the application isn't downloading any new code).

GroundControl gives you a dead-simple way to remotely configure your app, allowing you to add things likefeature flags, impromptuA/B tests, or a simple"message of the day".

It's built on top ofAFNetworking, and provides a single category onNSUserDefaults (just add#import "NSUserDefaults+GroundControl.h" to the top of any file you want to use it in).

Client Code

NSURL *URL = [NSURLURLWithString:@"http://example.com/defaults.plist"];[[NSUserDefaultsstandardUserDefaults]registerDefaultsWithURL:URL];

...or if you need callbacks for success/failure, and prefer not to listen for aNSUserDefaultsDidChangeNotification:

NSURL *URL = [NSURLURLWithString:@"http://example.com/defaults.plist"];[[NSUserDefaultsstandardUserDefaults]registerDefaultsWithURL:URLsuccess:^(NSDictionary *) {// ...}failure:^(NSError *) {// ...}];

...or if you need to use an HTTP method other than GET, or need to set any special headers, specify anNSURLRequest:

NSURL *URL = [NSURLURLWithString:@"http://example.com/defaults.plist"];NSMutableURLRequest *request = [NSMutableURLRequestrequestWithURL:URL];[[NSUserDefaultsstandardUserDefaults]registerDefaultsWithURLRequest:requestsuccess:^(NSURLRequest *,NSHTTPURLResponse *,NSDictionary *) {// ...}failure:^(NSURLRequest *,NSHTTPURLResponse *,NSError *) {// ...}];

Server Code

GroundControl asynchronously downloads and reads a remote plist file. This could be a static file or generated dynamically, like in the following examples (see also the complete Sinatra application found inexample/server):

Ruby

require'sinatra'require'plist'get'/defaults.plist'docontent_type'application/x-plist'{'Greeting'=>"Hello, World",'Price'=>4.20,'FeatureXIsLaunched'=>true}.to_plistend

Python

fromdjango.httpimportHttpResponseimportplistlibdefproperty_list(request):plist= {'Greeting':"Hello, World",'Price':4.20,'FeatureXIsLaunched':True,'Status':1    }returnHttpResponse(plistlib.writePlistToString(plist))

Node.js

varplist=require('plist'),express=require('express')varhost="127.0.0.1"varport=8080varapp=express()app.get("/",function(request,response){response.send(plist.build({'Greeting':"Hello, World",'Price':4.20,'FeatureXIsLaunched':true,'Status':1}).toString())})app.listen(port,host)

License

GroundControl is available under the MIT license. See the LICENSE file for more info.

About

Remote configuration for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp