"Boycott Apple until such time as they give that information," Trump said at a campaign event in Pawleys Island, South Carolina. "It just occurred to me."
Trump, front-runner for the Republican nomination ahead of the November 8 presidential election, made the off-the-cuff comment at a town hall-style event at a country club, a day before the state's nominating contest.
Even as he was still speaking, Trump's campaign posted on his Twitter handle (@real Donald Trump) from an iPhone, with the timestamp labeled "via Twitter for iPhone."
Trump later posted on Twitter that he used both an iPhone and a Samsung device.
In response, senior Apple executives, on a call with reporters on Friday, said they felt they were in good company given the other groups and people Trump has criticized in the past. They defended encryption as a way to protect Apple customers' rights.
It was not the first attack on the world's best-known technology company by the real estate mogul and reality TV personality. Trump has previously been critical of Apple, which has its headquarters in Cupertino, California, for not producing enough of its products in the United States.
"We're gonna get Apple to start building their damn computers and things in this country, instead of in other countries," Trump said in a January speech at Liberty University in Virginia.
Apple is resisting US government demands that it unlock an iPhone used by Rizwan Farook, who along with his wife, Tashfeen Malik, shot and killed 14 people and wounded 22 others at a holiday party in San Bernardino last December.
Trump made his comments as the US Department of Justice filed a motion seeking to force Apple to comply with a judge's order for the company to unlock the phone, portraying the tech company's refusal as a "marketing strategy."
The filing increased tension in a showdown between the Obama administration and Silicon Valley over security and privacy. The government has said the couple were sympathizers of Islamic State militants and wants to open the phone to find out more about possible connections and contacts.
"If Apple doesn't give the information to the authorities on the radical Islamic terrorists, I'll only be using a Samsung - until such time as they give the information," Trump tweeted.
"Hopefully others will follow suit. Our country needs and should demand security. It is time to get tough and be smart!"
It was not the first time Trump has called for a boycott. In November, he lobbied for a Starbucks Corp boycott because the coffee chain's red holiday cups lacked Christmas-related decorations.
He has repeatedly urged people not to shop at Macy's after the department store dropped his signature business clothing line because of comments he made about Mexicans.
© Thomson Reuters 2016