A method for wireless communication, comprising: sending, by a terminal device, a first message in a random access procedure to a network device, wherein the first message comprises a random access preamble; and detecting, by the terminal device, a first Random Access Response, RAR, for the first message by using a first RAR format or a second RAR format according to a type of an uplink carrier sending the first message, wherein the first RAR format is different from the second RAR format; wherein the uplink carrier is an uplink unlicensed carrier or an uplink licensed carrier, and detecting, by the terminal device, the first RAR for the first message by using the first RAR format or the second RAR format according to the type of the uplink carrier sending the first message comprises: detecting, by the terminal device, the first RAR by using the first RAR format if the terminal device sends the first message to the network device on the uplink unlicensed carrier; and/or detecting, by the terminal device, the first RAR by using the second RAR format if the terminal device sends the first message to the network device on the uplink licensed carrier; wherein the first RAR format comprises first information for an unlicensed carrier, and the second RAR format does not comprise the first information; wherein the first information comprises the following information: a Listen Before Talk, LBT, category, used for indicating a channel access mechanism. sending, by a terminal device, a first message in a random access procedure to a network device, wherein the first message comprises a random access preamble; and detecting, by the terminal device, a first Random Access Response, RAR, for the first message by using a first RAR format or a second RAR format according to a type of an uplink carrier sending the first message, wherein the first RAR format is different from the second RAR format; wherein the uplink carrier is an uplink unlicensed carrier or an uplink licensed carrier, and detecting, by the terminal device, the first RAR for the first message by using the first RAR format or the second RAR format according to the type of the uplink carrier sending the first message comprises: detecting, by the terminal device, the first RAR by using the first RAR format if the terminal device sends the first message to the network device on the uplink unlicensed carrier; and/or detecting, by the terminal device, the first RAR by using the second RAR format if the terminal device sends the first message to the network device on the uplink licensed carrier; wherein the first RAR format comprises first information for an unlicensed carrier, and the second RAR format does not comprise the first information; wherein the first information comprises the following information: a Listen Before Talk, LBT, category, used for indicating a channel access mechanism. detecting, by the terminal device, the first RAR by using the first RAR format if the terminal device sends the first message to the network device on the uplink unlicensed carrier; and/or detecting, by the terminal device, the first RAR by using the second RAR format if the terminal device sends the first message to the network device on the uplink licensed carrier; wherein the first RAR format comprises first information for an unlicensed carrier, and the second RAR format does not comprise the first information; wherein the first information comprises the following information: a Listen Before Talk, LBT, category, used for indicating a channel access mechanism.