emotality / atappupdater Goto Github PK
View Code? Open in Web Editor NEWChecks if there is a newer version of your app in the AppStore and alerts the user to update.
License: MIT License
Checks if there is a newer version of your app in the AppStore and alerts the user to update.
License: MIT License
There is a very useful control.
But you have to be very careful when using it.
Apple rejected my application because of this control.
I received message that below from Apple.
10.6 Details
Your app includes an update button or alerts the user to update the app. To avoid user confusion, app version updates must utilize the iOS built-in update mechanism.
We’ve attached screenshot(s) for your reference.
Next Steps
Please remove the update feature from your app. To distribute a new version of your app, upload the new app binary version into the same iTunes Connect record you created for the app’s previous version. Updated versions keep the same Apple ID, iTunes Connect ID (SKU), and bundle ID as the original version, and are available free to customers who purchased a previous version.
Hello!
The following line from ATAppUpdater.m is making an HTTP request. An attacker listening in the middle of the connection could change the results returned from the server, such as setting a malicious trackViewUrl and fool the app with a fake update link.
NSURL *lookupURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", bundleIdentifier]];
Don't you think it makes more sense to use HTTPS?
This will be really great if you wrap it into Cocoa Pod.
Thanks for great lib!
Can you make it support tesflight releases?
The current implementation just checks whether the currentVersion is different than the latestVersion with a String comparison:
if (![latestVersion isEqualToString:currentVersion])
This causes development versions to constantly trigger the notification. I suggest the following amendment in order to check whether the latestVersion is greater than the currentVersion based on a float. This way you make sure the development version doesn't trigger the notification:
if([latestVersion floatValue]>[currentVersion floatValue])
Or add a parameter which allows to choose the type of comparison, i.e. string vs float...
Hi,
I just found your project. This's exactly what I want. But when I added it to my code, my app crashed when I tap on "Update". Here's the log:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:appStoreURL]]; // Error: Thread: 1: EXC_BAD_ACCESS (code=1, address=0x347426fd46e7469)
Please note my app not yet published so I replace 'lookupURL' in ATAppUpdater.m with another bundle ID.
Thanks and best regards,
Django
I m gating response like this.
{
"resultCount": 0,
"results": []
}
When I open the App, the alert appears with force and carry to AppStore, but if I come back without update the App, the Alert don´t appear again. This occurs in Cordova App.
NSURL *lookupURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/lookup?bundleId=%@", bundleIdentifier]];
使用这个请求路径,目前很难返回结果。经测试,需要加上国家:
NSURL *lookupURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/lookup?bundleId=%@&country=cn", bundleIdentifier]];
请测试看看。谢谢
Hello
What about developing also delegate methods?
Like those ones:
- (void)atAppUpdaterDidShowUpdateDialog
- (void)atAppUpdaterUserDidLaunchAppStore
- (void)atAppUpdaterUserDidSkipVersion
- (void)atAppUpdaterUserDidCancel
updater.alertMessage = NSLocalizedString(@"最新版本位为:%@ ", @"Alert Message");
error :Could not find a storyboard named 'Main' in bundle NSBundle
The delegate does not fire on iOS 10 and does not open the App Store anymore.
Approach 1:
I have added ATAppUpdater folder in project (screenshot 1). Now, when I try to #import "ATAppUpdater.h" file in view controller it is not available. It forces to use #import "ATAppUpdater/ATAppUpdater.h" (screenshot 2). Now, when application is build it prompts several errors (screenshot 3)
Approach 2:
Since Reachability file is already present in application I have imported only ATAppUpdater .h/.m file.
After building application it prompts error (screenshot 4)
Any fix?
Hello,
Does your class support "Test Flight" ?
The code uses dispatch_async
to spawn off a new thread, then uses the synchronous networking call dataWithContentsOfFile:
in there, which likely spawns off its own networking thread and blocks the current one.
Would be better to just use NSURLSession to build the request and forego the thread. It will just call you back on the main thread once your data has arrived.
var updater = ATAppUpdater.sharedUpdater()
updater.alertTitle = "aaa"
updater.alertUpdateButtonTitle = "b"
updater.alertCancelButtonTitle = "cc"
error: " updater is immutable"
I change my code to below:
var updater = ATAppUpdater.sharedUpdater() as! ATAppUpdater
after setting the properties the alert view remains little things that not set by code.
Hello
I have to ask you about Https support introduced with iOS 9. What I can see from your code is the following:
NSURL *lookupURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", bundleIdentifier]];
So you use Http. What about Https? Have you to distinguish among iOS version also?
Same question about:
const char *host = "itunes.apple.com";
Always speaking about connectivity checking: why did you use Apple site? Is it safe enough? Why not Google, for example?
Thank you very much.
app store version is 1.4.135, Install the 1.4.135 on iPhone
NSString *currentVersion = [bundleInfo objectForKey:@"CFBundleShortVersionString"];
// 1.4
NSString *latestVersion = [appDetails objectForKey:@"version"];
//1.4.135
//This will be true
if ([latestVersion compare:currentVersion options:NSNumericSearch] == NSOrderedDescending) {
//This will be true
}
Cartfile:
github "emotality/ATAppUpdater"
Terminal:
iMac:App-iOS-Sources user$ carthage update --platform iOS --no-use-binaries
*** Cloning ATAppUpdater
*** Checking out ATAppUpdater at "2.0"
*** xcodebuild output can be found in > /var/folders/nb/9g4bcynn1bbbl93rrd7nns4h0000gn/T/carthage-xcodebuild.GXFOtL.log
*** Skipped building ATAppUpdater due to the error:
Dependency "ATAppUpdater" has no shared framework schemes for any of the platforms: iOS
If you believe this to be an error, please file an issue with the maintainers at https://github.com/emotality/ATAppUpdater/issues/new
If the iOS simulator or device has no connection to the Internet, ATAppUpdater causes the app the crash. Was able to repeat this multiple times. Commenting out [[ATAppUpdater sharedUpdater] forceOpenNewAppVersion:NO];
fixes it, but of course, that removes ATAppUpdater.
This is the error message from the console.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
*** First throw call stack:
(
0 CoreFoundation 0x00000001134cca75 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001138abbb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001134cc9ad +[NSException raise:format:] + 205
3 Foundation 0x000000011144482f +[NSJSONSerialization JSONObjectWithData:options:error:] + 67
4 xxxxxxxx 0x000000010ee31683 -[ATAppUpdater checkNewAppVersionWithBlock:] + 403
5 xxxxxxxx 0x000000010ee313bb -[ATAppUpdater forceOpenNewAppVersion:] + 203
6 xxxxxxxx 0x000000010ee4013f -[AppDelegate application:didFinishLaunchingWithOptions:] + 207
7 UIKit 0x0000000111e9b458 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
8 UIKit 0x0000000111e9c002 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2540
9 UIKit 0x0000000111e9ee3e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
10 UIKit 0x0000000111e9dd35 -[UIApplication workspaceDidEndTransaction:] + 179
11 FrontBoardServices 0x0000000117fed243 __31-[FBSSerialQueue performAsync:]_block_invoke + 16
12 CoreFoundation 0x0000000113401c7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
13 CoreFoundation 0x00000001133f79c5 __CFRunLoopDoBlocks + 341
14 CoreFoundation 0x00000001133f7785 __CFRunLoopRun + 2389
15 CoreFoundation 0x00000001133f6bc6 CFRunLoopRunSpecific + 470
16 UIKit 0x0000000111e9d7a2 -[UIApplication _run] + 413
17 UIKit 0x0000000111ea0580 UIApplicationMain + 1282
18 xxxxxxxx 0x000000010ee4b163 main + 115
19 libdyld.dylib 0x000000011450e145 start + 1
)
Here i have shared part of crash log :
0 libsystem_kernel.dylib 0x0000000180a3d014 semaphore_wait_trap + 8 (syscall_sw.h:110)
1 libdispatch.dylib 0x000000018091a3e8 _dispatch_semaphore_wait_slow + 244 (semaphore.c:383)
2 CFNetwork 0x00000001814fa9a4 CFURLConnectionSendSynchronousRequest + 288 (CFURLConnection_Synchronous.c:217)
3 CFNetwork 0x000000018151e0c4 +[NSURLConnection sendSynchronousRequest:returningResponse:error:] + 120 (NSURLConnection.mm:516)
4 Foundation 0x00000001817ec0e8 -[NSData(NSData) initWithContentsOfURL:] + 208 (NSData.m:874)
5 Foundation 0x00000001817ec004 +[NSData(NSData) dataWithContentsOfURL:] + 48 (NSData.m:715)
6 DemoAPP 0x000000010007c660 __35-[ATAppUpdater checkNewAppVersion:]_block_invoke + 48 (ATAppUpdater.m:129)
7 libdispatch.dylib 0x00000001809094bc _dispatch_call_block_and_release + 24 (init.c:760)
8 libdispatch.dylib 0x000000018090947c _dispatch_client_callout + 16 (object.m:506)
9 libdispatch.dylib 0x0000000180917914 _dispatch_root_queue_drain + 2140 (inline_internal.h:1063)
10 libdispatch.dylib 0x00000001809170b0 _dispatch_worker_thread3 + 112 (queue.c:4249)
11 libsystem_pthread.dylib 0x0000000180b21470 _pthread_wqthread + 1092 (pthread.c:1990)
12 libsystem_pthread.dylib 0x0000000180b21020 start_wqthread + 4 (pthread_asm.s:190)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.