2011-06-07 78 views
4

我非常困惑。如何才能在应用程序的使用时间内只显示协议页面一次。我不怎么能解释这一点,但我试图解释这一点。 我创造,我有其中有两个按钮协议页的应用程序 (1)按钮名称为接受 (2)按钮名称为拒绝选择页面时出现问题(许可证协议页面)

如果用户点击接受按钮应用进入下一页但是,当用户点击拒绝按钮应用程序退出应用程序。 但扭曲在这里 如果用户第一次运行此应用程序,他会看到协议页面,如果用户接受此协议,那么只有当他移动更远之后。 但是当用户一次又一次地使用这个应用程序时,如果他已经接受协议,他一定不会再看到协议页面。 请帮我解决这个问题,我很困惑。 在此先感谢

回答

4

你可以通过ALTER VIEW应用协议页

如果用户接受比你存储的约定的价值(可能Bollean)在plist文件(可能的文档目录的协议APP) 每次比你可以检查它

enter image description here

CODE FOR如果接受一次

TO不显示协议

中添加一个plist文件到资源文件夹
添加一个布尔变量的plist值作为取消选中(遭到拒绝的州)

//复制的plist到文档目录

-(void)CopyPlistTODocument 
    { 

BOOL success; 
NSFileManager *fileManager = [NSFileManager defaultManager]; 
NSError *error; 
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *writableDBPath= [documentsDirectory stringByAppendingPathComponent:@"Settings.plist"]; 
success = [fileManager fileExistsAtPath:writableDBPath]; 
if (success) return; 
// The writable database does not exist, so copy the default to the appropriate location. 
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Settings.plist"]; 
success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error]; 
if (!success) { 
    NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]); 
} 

} 

//NOW Call Another method that read data form plist of document directory 
     -(void)desclaimer 
    { 
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectoryPath = [paths objectAtIndex:0]; 
NSString *path =[documentsDirectoryPath stringByAppendingPathComponent:@"setting.plist"]; 
NSMutableDictionary *plist = [NSMutableDictionary dictionaryWithContentsOfFile: path]; 
BOOL *temp=[plist valueForKey:@"Agreement"]; 
//if the value of the temp got YES That Agreed earlier so no need to agreed again 
if ([temp isEqualToString:@"NO"]) 
{ 
    //Show Alert View From Here And call Method Accept() on the button   pressed event of the accept button 
} 
    } 
//Now From Button Pressed Event Of The Accept Here is the Accept method 
    -(void)Accept 
    { 
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectoryPath = [paths objectAtIndex:0]; 
NSString *path =[documentsDirectoryPath stringByAppendingPathComponent:@"Settings.plist"]; 
NSMutableDictionary *plist = [NSMutableDictionary dictionaryWithContentsOfFile: path]; 
[plist setValue:@"YES" forKey:@"Agreement"]; 
    //now every time the value read from here has agreed state so alert view will not get called 
[plist writeToFile:path atomically:YES]; 

    } 
+0

我怎么能做到这一点,你能解释我更多 – Ajay 2011-06-07 08:45:50

+0

检查更新的代码 – NIKHIL 2011-06-07 09:17:48

+0

我应该在哪里写这个code.And你能解释更多更好的理解 – Ajay 2011-06-08 09:05:07

3

最好的解决方案是在您将应用程序发送到iTunes Connect时放置此许可协议,它有一个特别的地方。

因此如果用户不同意,他不会在第一时间安装应用程序“iTunesConnect DeveloperGuide”页面

检查“EULA”部分52

希望它帮助你。

+0

是,任何代码我有写 – Ajay 2011-06-07 08:09:27

+0

没有,只需添加EULA在iTunes连接 – 2011-06-07 08:16:26

+0

你可以给我链接如何使用EULA – Ajay 2011-06-07 08:46:44