How can I run my game on an actual iPhone (with dev account)

How can I run my game on an actual iPhone (with dev account)
0.0 0

#1

Hi,
I’m a newbie to Cocos2d-x and to the new cocos-creator.
When I run my game it always runs on the iPhone simulator although I have my real iPhone device connected to my mac.
I couldn’t find information in the docs regarding how to run the game on an actual device, can you assist?

Bear in mind, I have a developer account and ran apps on my actual device before I started using cocos-creator.


#2

Open your .xcodeproj file in XCode.

I found my .xcodeproj file in:

MYPROJECTFOLDER/build/jsb-default/frameworks/runtime-src/proj.ios_mac/MYPROJECTNAME.xcodeproj

Then set your Team in XCode like normal:
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/Art/3_assignteam_ios_2x.png

The above image is from: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html


#3

Thanks man for taking the time to answer.
And then do I need to build using Xcode?
When I try to build using Xcode it fails to compile, and if I try using the cocos creator it opens on the simulator.


#4

Yep, you need to successfully build in XCode. What build errors are you getting in XCode?


#5

clang: error: linker command failed with exit code 1 (use -v to see invocation)


#6

I think this problem is unrelated to cocos. Just from googling, this looks somewhat promising:

Did you explicitly import anything in XCode?

You should be able to:

  1. In Cocos Creator do Project -> Build. In the new window click Build.
  2. When Build finishes, click Compile in that same build window.
  3. Open the .xcodeproj file in XCode (the one found above in this thread)
  4. In XCode, Product -> Build
  5. In XCode, with your device connected to your computer, choose your device next to the Play and Stop buttons in the top left.
  6. Click Play

This will install your game onto your device.