1. An information processing apparatus, comprising: a memory configured to store instructions; and a processor configured to execute the instructions to: display a setting screen for setting a naming rule, wherein the displayed setting screen receives setting of information for each item of a plurality of items to be used as the naming rule for generating a file name; determine, when a user selects a target item from the plurality of items in the setting screen for changing information being set for the target item, whether the plurality of items other than the target item includes an item for which information that defines the file name to be unique has been set; restrict, in the displayed setting screen, information that can be changed for the target item to the information that defines the file name to be unique, where it is determined that none of the plurality of items other than the target item includes an item for which the information that defines the file name to be unique has been set, wherein the information that can be changed for the target item is not restricted to the information that defines the file name to be unique, where it is determined that the plurality of items other than the target item includes an item for which the information that defines the file name to be unique has been set; store, as the naming rule, information being set for the plurality of items in the setting screen after the information being set for the target item has been changed; and generate a file name based on the stored naming rule.