The application bundle does not contain a valid identifier

On rare occasions Xcode will refuse to run your app on a device and you will come across this error

The application bundle does not contain a valid identifier. Domain: com.apple.dt.MobileDeviceErrorDomain Code: -402653108

Xcode

One of these three steps given below will resolve the issue for you

Clear Derived Data

Delete derived data then clean your project and run again. ou can clean derived data by going to Xcode->prefrences->locations. After this clean your project and run again.

Check for corrupt entitlement file

Open your entitlement file as source code. You will see code something like this

  <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key></key>
        <array>
            <string></string>
        </array>
        <key>com.apple.security.files.user-selected.read-write</key>
        <true/>
        <key>com.apple.security.network.server</key>
        <true/>
        <key>com.apple.security.personal-information.location</key>
        <true/>
        <key>com.apple.security.app-sandbox</key>
        <true/>
        <key>com.apple.security.network.client</key>
        <true/>
    </dict>
    </plist>

Try and identify empty entry as shown in the example above<key><key/> remove these empty keys and run again.

Clear Pods

Even after deleting derived data and checking your entitlements,you are still facing the issue then there is another hard way. Delete following

  1. Pods folder
  2. Pods.lock
  3. Workspace

Do not delete Pods file and Xcode project.

Now re-run pod install command to create workspace and install all pods.

Above given steps will work for most of the cases but in some rare scenario there can be a missing info.plist file or some other error. Comment if you are unable to resolve the issue even after following above mentioned steps.

A pat on the back !!