[IPhone] 如何在iphone app中提醒用户Rank或Review
2010-11-28 20:52
501 查看
Introduction
How can we remind user to review or rank in App?
We can show a alert box to remind user to review, I writed a sample code using singleton to remind user.
How to use
CloudReview.h
CloudReview.m
How can we remind user to review or rank in App?
We can show a alert box to remind user to review, I writed a sample code using singleton to remind user.
How to use
[[CloudReview sharedReview]reviewFor:395519376];
CloudReview.h
#import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface CloudReview : NSObject { int m_appleID; } +(CloudReview*)sharedReview; -(void) reviewFor:(int)appleID; -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; @end
CloudReview.m
#import "CloudReview.h" @implementation CloudReview static CloudReview* _sharedReview = nil; +(CloudReview*)sharedReview { @synchronized([CloudReview class]) { if (!_sharedReview) [[self alloc] init]; return _sharedReview; } return nil; } +(id)alloc { @synchronized([CloudReview class]) { NSAssert(_sharedReview == nil, @"Attempted to allocate a second instance of a singleton."); _sharedReview = [super alloc]; return _sharedReview; } return nil; } -(void)reviewFor:(int)appleID { m_appleID = appleID; BOOL neverRate = [[NSUserDefaults standardUserDefaults] boolForKey:@"neverRate"]; if(neverRate != YES) { //Show alert here UIAlertView *alert; alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"rate_title",@"Rate My Appication") message:NSLocalizedString(@"rate_main",@"Please Rate my Application") delegate: self cancelButtonTitle:NSLocalizedString(@"rate_cancel",@"Cancel") otherButtonTitles: NSLocalizedString(@"rate_now",@"Rate Now"), NSLocalizedString(@"rate_never",@"Never Rate"), nil]; [alert show]; [alert release]; } } -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { // Never Review Button if (buttonIndex == 2) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"neverRate"]; } // Review Button else if (buttonIndex == 1) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"neverRate"]; NSString *str = [NSString stringWithFormat: @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d", m_appleID ]; NSLog(str); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; } } @end
相关文章推荐
- 在iPhone App中提醒用户打分或写评价的方法
- 在iPhone App中提醒用户打分或写评价的方法
- 如何维持APP用户的登陆状态
- App正式发布前,开发者如何进行有效的用户测试
- 【用户交互】APP没有退出前台但改变系统属性如何实时更新UI?监听系统广播,让用户交互更舒心~
- iphone app为什么会被打回来的一些情况,如何制止?
- 如何增加APP开发用户数量,从而取得良好的市场效益?
- 安卓app中嵌入一个H5页面,当手机系统设置字体变大时,如何使H5页面的字体不会随用户自己调整的系统字体变化而变化?
- iPhone app中,提升网页列表用户体验的建议
- App成败论:如何获得2千万用户
- 如何用HTML5制作iPhone App
- 在iPhone应用中如何使用随机数(How to Use Random Numbers in Your iPhone App)
- 如何从iPhone/iPod的音乐库中拷贝音乐到自己的App里
- 如何把自己iphone app传到ios设备上
- 如何实现监听用户驻留APP的时长(service的简单用法)
- iOS 的 APP 如何适应 iPhone 5s/6/6Plus 三种屏幕的尺寸?
- Android 如何通知用户更新app的版本
- Android 如何通知用户更新app的版本
- iOS9中如何在日历App中创建一个任意时间之前开始的提醒(二)