1. A method of operating an electronic device based on optical object recognition comprising: executing an optical recognition function; recognizing an object outside the electronic device via an optical sensor; searching for an Internet of Things (IoT) target device related to the recognized object; recommending an IoT action related to the recognized object; automatically preparing for and executing the IoT action; and performing voice feedback regarding the IoT action and the IoT target device.