Unable to build Xcode project after importing sdkbox

Hi.
I created a new project with cocos2d-x v4 and imported admob with sdkbox.
The build was canceled when I tried to run it in Xcode.

I don’t know the solution because the error log doesn’t show anything in particular.
How can I build it?

The steps to reproduce this are detailed below.
I am using
cocos2d-x-4.0
Cocos Console 2.3
SDKBOX version 1.4.1.0
Python 2.7.15
macOS Catalina 10.15.5
Xcode Version 11.6 (11E708)

I installed cocos2d-x v4 and set it up, then created a project.

cocos new CocosTest5 -l cpp -p info.mygames888.cocostest5

I created xcode project.

cd CocosTest5/
mkdir ios-build
cd ios-build
cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS

At this point, when I open xcode project and run, It built correctly and ran on my iphone.
However, when I imported sdkbox after this, it became impossible.

cd CocosTest5
sdkbox import admob

This is all I did.
admob should have been imported correctly, but I haven’t made any changes to the project yet.

I feel this problem is similar to the following topic.
https://discuss.cocos2d-x.org/t/cocos2d-x-v4-0-xcode-build-not-working-after-importing-several-sdkbox-sdks/51101

But this topic is still unresolved.

Can anyone please tell me how to solve this problem.

Thank you.

I read this page.


I followed it and ran cmake after importing sdkbox.
cd ios-build
cmake ..

When I then opened the Xcode project and ran it, the build wasn’t cancelled, but I got some Apple Mach-O Linker (ld) Error.

clang: error: no such file or directory:'GoogleUtilities.xcframework'
clang: error: no such file or directory:'PromisesObjC.xcframework'
clang: error: no such file or directory:'nanopb.xcframework'

How can I solve this?

thanks, we will look into this.

cmake is not support xcframework.

you can remove lines include *.xcframework in CMakeLists.txt
and then add *.xcframework to your generated xcode project manually

Info.plist in xcframework seems to be the cause of the problem.

Thank you.
I successfully built, but failed to run it on my iPhone.
I did the following:

I deleted the *.xcframework lines from CMakeLists and ran cmake …

cmake ..

Then I opened Xcode and manually imported 3 xcframeworks
nanopb.xcframework,
PromisesObjC.xcframework and
GoogleUtilities.xcframework.

And I changed the Build System to New Build System, cleaned and then built.
Then the build was successful but failed to run on iPhone with the following error.

Details

Unable to install "CocosTestZ"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
--
Could not inspect the application package.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
User Info: {
    DVTRadarComponentKey = 282703;
    MobileDeviceErrorCode = "(0xE8000051)";
    "com.apple.dtdevicekit.stacktrace" = (
	0   DTDeviceKitBase                     0x0000000120df781a DTDKCreateNSErrorFromAMDErrorCode + 233
	1   DTDeviceKitBase                     0x0000000120e38f70 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
	2   DVTFoundation                       0x0000000107a4ef35 DVTInvokeWithStrongOwnership + 73
	3   DTDeviceKitBase                     0x0000000120e38ca8 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1654
	4   IDEiOSSupportCore                   0x0000000120cafe91 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4165
	5   DVTFoundation                       0x0000000107b825d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
	6   DVTFoundation                       0x0000000107b84216 __DVTDispatchAsync_block_invoke + 1194
	7   libdispatch.dylib                   0x00007fff6cebf6c4 _dispatch_call_block_and_release + 12
	8   libdispatch.dylib                   0x00007fff6cec0658 _dispatch_client_callout + 8
	9   libdispatch.dylib                   0x00007fff6cec5c44 _dispatch_lane_serial_drain + 597
	10  libdispatch.dylib                   0x00007fff6cec65d6 _dispatch_lane_invoke + 363
	11  libdispatch.dylib                   0x00007fff6cecfc09 _dispatch_workloop_worker_thread + 596
	12  libsystem_pthread.dylib             0x00007fff6d11aa3d _pthread_wqthread + 290
	13  libsystem_pthread.dylib             0x00007fff6d119b77 start_wqthread + 15
);
}
--


System Information

macOS Version 10.15.6 (Build 19G2021)
Xcode 11.6 (16141)

Before importing sdkbox it was possible to run it on an iPhone.
I recreated a new cocos2d-x project and tried it, with the same results.
Do you know how to solve this?

Thank you.
Finally, I solved this problem.
For those who read this post later, I wrote below how to import admob with sdkbox into a project made with cocos2d-x v4.

After installing cocos2d-x v4, create a project in any location.

cocos new CocosTest -l cpp -p com.mydomain.cocostest

Create an ios-build folder in the project folder and create an Xcode project file in it.

cd CocosTest
mkdir ios-build
cd ios-build
cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos

Import admob with sdkbox.

cd CocosTest
sdkbox import admob

Open CMakeLists.txt and delete the following 3 lines.

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} GoogleUtilities.xcframework")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} PromisesObjC.xcframework")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} nanopb.xcframework")

Run cmake …

cd ios-build
cmake ..

Open the Xcode project located in the ios-build folder.
Right-click in the left pane and create a new group named Frameworks
Drag GoogleUtilities.xcframework, nanopb.xcframework and PromisesObjC.xcframework in proj.ios_mac to Frameworks.

At that time, check the target of the project name.

Targets->Project Name->Frameworks, Libraries, Embedded Content
Press + button and add 3 xcframeworks.
Select Embed & Sign.

Targets->Project Name->Signing & Capabilities->All->Signing->Team
Select the appropriate team.

Targets->Project Name->Build Phases->Link Binary with Libraries
Make sure there are 3 xcframeworks you added.

Disclose Embed Frameworks and Enable “Copy only when installing”.

File->Project Setting->Build System

Change from “Legacy Build System” to “New Build System (Default)”.

Select the target of project name and run.
You build successfully.

I’ve been worried for hours not seeing AdMob ads.
Eventually I solved the problem.
I commented out

#ifdef SDKBOX_ENABLED

in AppDelegate::applicationDidFinishLaunching().

Somehow SDKBOX_ENABLED was not defined and sdkbox::PluginAdMob::init() was not called.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.