Light's Blog

The best or nothing.

iOS知识小集-170821

| Comments

ipa架构

IPA File
  Payload
    {appname}.app
      Application Binary
      Mobile Provision File
      Code Signature
      Bundled Resource File
  iTunesArtwork
  iTunesMetadata.plist

Insecure Local Data Storage

  1. PropertyList files
  2. NSUserDefaults class
  3. KeyChain
  4. CoreData and SQLite databases

Apple Data Protection API

  1. Complete Protection (NSFileProtectionComplete)
  2. Protected Unless Open (NSFileProtectionCompleteUnlessOpen)
  3. Protected Until First User Authentication (NSFileProtectionCompleteUntilFirstUserAuthentication)
  4. No Protection (NSFileProtectionNone)

NSTimeZone

1
2
3
4
5
NSTimeZone *timeZone = [NSTimeZone localTimeZone];
//  Asia/Shanghai
NSString *name = timeZone.name;
//  GMT+8
NSString *abbreviation = timeZone.abbreviation;

Prevent Buffer Overflows

  1. Address Space Layout Randomization (ASLR)
  2. Automatic Reference Counting (ARC)
  3. Stack Protectors

System Call

1
2
3
4
-(void)makeCall:(NSString *)phone{
  NSString *phoneNumber = [@"telprompt://" stringByAppendingString:phone];
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
}

NSString to NSURL

1
2
NSString *encodeURL = [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
NSURL *url = [NSURL URLWithString:encodeURL];

Comments