아이폰 시스템 메일박스 주소 얻기


- (NSArray*)sysEmails{
    NSString *path = @"/var/mobile/Library/Preferences/com.apple.accountsettings.plist";
    NSDictionary *d = [NSDictionary dictionaryWithContentsOfFile:path];
	NSArray *accounts = [d valueForKey:@"Accounts"];
    
    NSMutableArray *accountsFound = [NSMutableArray array];
    
    // NSLog(@"counts are %@",accounts);
    
	for(NSDictionary *account in accounts) {
		NSString *classValue = [account valueForKey:@"Class"];
        if([classValue isEqualToString:@"POPAccount"])    {
            [accountsFound addObject:[NSString stringWithFormat:@"POPAccount are %@",[account objectForKey:@"Username"]]];
            NSLog(@"POPAcounts are %@",account);
        }
        
        if([classValue isEqualToString:@"GmailAccount"])   {
            [accountsFound addObject:[NSString stringWithFormat:@"GmailAccount are %@",[account objectForKey:@"Username"]]];
            NSLog(@"GmailAccount are %@",account);
        }
        
		if([classValue isEqualToString:@"IMAPAccount"])	   {
            [accountsFound addObject:[NSString stringWithFormat:@"IMAPAccount are %@",[account objectForKey:@"Username"]]];
            NSLog(@"IMAPAccount are %@",account);
        }
        
        if([classValue isEqualToString:@"YahooAccount"])   {  
            [accountsFound addObject:[NSString stringWithFormat:@"YahooAccount are %@",[account objectForKey:@"Username"]]];
            NSLog(@"YahooAccount are %@",account);
        }
    }
    return accountsFound;
}

좋은 웹페이지 즐겨찾기