Proper way of saving and loading pictures

前端 未结 3 1470
说谎
说谎 2021-02-04 13:41

I am making a small app where the user can create a game profile, input some data and a picture that can be taken with the camera.

I save most of that profile data with

3条回答
  •  盖世英雄少女心
    2021-02-04 14:41

    One way to do this is use the application's document directory. This is specific to a application and will not be visible to other applications.
    How to create this:
    Just add a static function to App Delegate and use the function where ever the path is required.

    - (NSString )applicationDocumentDirectory {
        /
         Returns the path to the application's documents directory.
         */ 
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
        return basePath;
    }
    
    Hope it Helped..

提交回复
热议问题