开源库


https://github.com/nicklockwood/iVersion

添加Configurations

1.png

添加 宏定义

2.png

编写自动更新代码

编辑AppDelegate.m

#pragma mark - iVersion

#ifdef GITHUB
+ (void)initialize
{
//configure iVersion. These paths are optional - if you don't set
//them, iVersion will just get the release notes from iTunes directly (if your app is on the store)

[iVersion sharedInstance].remoteVersionsPlistURL = @"https://gpxj.github.io/versions.plist";
[iVersion sharedInstance].localVersionsPlistPath = @"versions.plist";
NSString *updateUrl = @"itms-services:///?action=download-manifest&url=https://gpxj.github.io/gpxj.plist";

[iVersion sharedInstance].updateURL = [NSURL URLWithString:updateUrl];
}
#endif

添加 version.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>0.1.0</key>
<array>
<string>First Version.</string>
</array>
</dict>
</plist>