New OC project

1.1 Create a new project

Long time no new projects from scratch, and create a new project operations are forgotten, we recall here.

Test Platform: macOS 10.15.1, Xcode 11.2.1 (11B500), earlier operating and now basically similar operation can be mastered.

选择 iOS > Application > Single View App > Next

$ Product Name: Project name (according to the needs a name, the name of the product installed on your phone based on it, but there was no causal relationship between, you can customize the product name), as the project name used here Demo

$ Team: Select already registered developer account

$ Organization Identifier: domain name is generally reversed (Sina is com.sina, Baidu is com.baidu), because the domain name is the only

$ Bundle Identifier: package name, automatically generated (+ Product Name consists Organization Identifier), due to the uniqueness of the domain name, we can ensure that within the same company, the name of the product package will not be repeated.

$ Language: language development, Swift with Objective-C, because they can be mixed, then that is both available, but still prefer your main development language

$ User Interface: it is an option, Storyboard.

 

1.1.2 Basic Configuration

In the new project, there are a lot of documents, divided into four groups, Demo, DemoTests, DemoUITests, Products

First focus on the Demo folder, it contains

$ AppDelegate see to know the name of justice

$ SceneDelegate, the word read / si: n / Sen ~ sound, not Seney, nor is the sine function sin, he is iOS13 out of the East, but also discuss the second step, the first step let us go slowly well, so delete it!

$ ViewController, demo use, temporarily delete, in fact commercial projects which are to be deleted.

$ Main.storyboard, because I used to build the project the code base, this basically do not, so I'm used to delete, and certainly not a deleted it, there are some operations to do after deleted, or item not up and running.

$ Assets.xcassets, management app icon to launch the project-level picture page etc.

$ LaunchScreen.storyboard, being the first do not delete, do not talk here of how code control LaunchScreen (put advertising), but it did not affect me back to use the [UIScreen mainScrren] .bounds value.

$ Info.plist, a project to use the basic configuration information is here

$ Main.m, project start entry file, which is the reason why the project entrance, not because it is a file called mian, but it contains a function called main, this is a function entry program (C language program,

      Or program base on C language (for example: OC), are the main entry point), learn the C language small business owners who are clearing the door, as the file name contains the main function is not important.

 

Configuration:

1.1.2.1, in the project to create a new Group, named: Supporting Files, the default in previous releases is there, I do not know since when, was canceled.

  Then the Group for what to put it? 

  The initial project put most of the resource file, 

  $ Assets.xcassets

  $ info.plist

  $ main.m

  When doing a commercial project, regardless of its size, it should be to do the engineering group, to facilitate their own, but also facilitate the subsequent expansion of others, to maintain. 

  The first stage,

    Such as micro-channel, four basic modules "micro-letters", "Contacts", "discovery", "I"

    Then at least four points Group, there may be several engineering level utility modules, such as data persistence module, network interface modules, tools module, it can also be based on demand with products based module level grade

  second level,

    Inside the first stage, and then divided according to design patterns, such as MVC, it is divided into 3 group, Controllers, Views, Models

    

1.1.2.2, the configuration file

1.1.2 In the front, and I put a lot of files to be deleted directly, then no miracle, at this time the project is not up and running (or running up immediately on the crash)

@ 1 as shown above, found in the project Build Settings> Packaging> Info.plist File, corrected his path value

  It should be specified, we project inside the new Group when there are two options, 

  $ New Group: Create a new Group, at the same time creates a corresponding folder in the project directory, then its internal file path values ​​have changed relatively speaking, 

  $ New Group without folder: created only in engineering Group, but not generated corresponding to the folder, it merely indicates a logical relationship, and does not change the value of the path

  Well, I just built a Supporting Files, while there is also a corresponding internal project folder, then later I info.plist dragged into its path becomes / Test / Supporting Files from the /Test/info.plist / info .plist

@ 2 because I deleted the main.storyboard, then find it in the project General tab of deleted (if Launch.storyboard been deleted, but also to find his configuration item to remove its value)

 

As well as in info.plist configuration file Application Scene Manifest and his child configuration can be deleted.

  

 @ 3 We did not use to SceneDelegate, then about it can be deleted, including the overall figure above info.plist delete the Application Scene Manifest configuration items, follow the chat on SceneDelegate

There is also the code on AppDelegate.m SceneDelegate of all deleted

@ 4 configuration rootViewController, because we are here to test, they engage in less complex, the direct use project that comes ViewController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    CGRect frame = [UIScreen mainScreen].bounds;

    UIWindow *window = [[UIWindow alloc] initWithFrame:frame];

    window.rootViewController = [[ViewController alloc] init];

    [Window of the Mac Che ndVisible ];

    self.window = window;

    return YES;

}

If you find LaunchScreen.stroyboard accidentally deleted, then [ UIScreen  mainScreen ] .bounds ; acquired value is not accurate enough, if LaunchScreen.storyboard and not deleted, but found still not allowed to get the screen size, you can check info.plist, whether there is a "Launch screen interface file base name" , its value is "LaunchScreen.storyboard", if not, or the value of the error, correct yourself.

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/penfree/p/11994746.html