2011-06-07 36 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