Skip to content

Commit c5f83bb

Browse files
committed
Fixed iOS build.
1 parent fae84f1 commit c5f83bb

File tree

14 files changed

+56
-34
lines changed

14 files changed

+56
-34
lines changed

demo/.godot/uid_cache.bin

-171 Bytes
Binary file not shown.

demo/export_presets.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ application/additional_plist_content=""
257257
application/icon_interpolation=4
258258
application/export_project_only=false
259259
application/delete_old_export_files_unconditionally=false
260+
plugins/InappReviewPlugin=true
260261
entitlements/increased_memory_limit=false
261262
entitlements/game_center=false
262263
entitlements/push_notifications="Disabled"
@@ -473,13 +474,12 @@ icons/app_store_1024x1024="res://assets/1024.png"
473474
icons/app_store_1024x1024_dark=""
474475
icons/app_store_1024x1024_tinted=""
475476
application/targeted_device_family=2
476-
application/min_ios_version="14.3"
477+
application/min_ios_version="16.0"
477478
storyboard/image_scale_mode=0
478479
storyboard/custom_image@2x=""
479480
storyboard/custom_image@3x=""
480481
storyboard/use_custom_bg_color=false
481482
storyboard/custom_bg_color=Color(0, 0, 0, 1)
482-
plugins/InappReviewPlugin=true
483483
application/generate_simulator_library_if_missing=true
484484
capabilities/push_notifications=false
485485
icons/ipad_76x76=""

ios/Podfile

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,48 @@
55
source 'https://github.com/CocoaPods/Specs.git'
66
use_frameworks!
77

8-
# Manually parse config.properties
8+
# Get the directory of the Podfile
9+
podfile_dir = File.dirname(__FILE__)
10+
11+
# Construct paths to both config files relative to the Podfile
12+
ios_config_path = File.join(podfile_dir, 'config', 'config.properties')
13+
common_config_path = File.join(podfile_dir, '..', 'common', 'config.properties')
14+
15+
# Initialize properties map
916
properties = {}
10-
begin
11-
File.foreach('config/config.properties') do |line|
12-
# Skip comments and empty lines
13-
line = line.strip
14-
next if line.empty? || line.start_with?('#', '!')
15-
# Split on the first '=' to handle values containing '='
16-
key, value = line.split('=', 2).map(&:strip)
17-
properties[key] = value if key && value
18-
end
19-
rescue Errno::ENOENT
20-
puts "Error: config/config.properties not found. Podfile cannot proceed without configuration."
21-
exit 1
17+
18+
# Helper function to read properties from a file
19+
def read_properties(file_path, properties)
20+
begin
21+
File.foreach(file_path) do |line|
22+
# Skip comments and empty lines
23+
line = line.strip
24+
next if line.empty? || line.start_with?('#', '!')
25+
# Split on the first '=' to handle values containing '='
26+
key, value = line.split('=', 2).map(&:strip)
27+
properties[key] = value if key && value
28+
end
29+
rescue Errno::ENOENT
30+
puts "Error: #{file_path} not found. Podfile cannot proceed without configuration."
31+
exit 1
32+
end
2233
end
2334

24-
plugin_name = "#{properties['plugin_node_name']}Plugin"
35+
# Read common config first
36+
read_properties(common_config_path, properties)
37+
38+
# Read project-specific config second (overrides common config)
39+
read_properties(ios_config_path, properties)
40+
41+
plugin_project_name = "#{properties['ios_project_name']}_plugin"
2542

26-
project "#{plugin_name}.xcodeproj"
27-
workspace "./#{plugin_name}.xcodeproj/project.xcworkspace"
43+
project "#{plugin_project_name}.xcodeproj"
44+
workspace "./#{plugin_project_name}.xcodeproj/project.xcworkspace"
2845

2946
# Extract dependencies (assuming a comma-separated list of name:version pairs)
3047
deps = properties['dependencies']&.split(',')&.map(&:strip) || []
3148

32-
target "#{plugin_name}" do
49+
target "#{plugin_project_name}" do
3350
platform :ios, properties[:platform_version] || '14.3'
3451

3552
# Install each dependency with its version

ios/config/config.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# © 2024-present https://github.com/cengiz-pz
33
#
44

5-
initialization_method=deeplink_plugin_init
6-
deinitialization_method=deeplink_plugin_deinit
5+
ios_project_name=inapp_review
6+
initialization_method=InappReviewPlugin_init
7+
deinitialization_method=InappReviewPlugin_deinit
78
frameworks=Foundation.framework,StoreKit.framework
89
embedded_frameworks=
910
flags=-ObjC,-Wl,-weak-lswiftCore,-weak-lswiftObjectiveC,-weak-lswift_Concurrency
1011
dependencies=
11-
platform_version=14.3
12+
platform_version=16.0
1213
valid_godot_versions=,4.1,4.2,4.3,4.4.1,4.5
1314
extra_properties=

ios/inapp_review/godot_plugin.mm

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
#import "inapp_review_plugin.h"
88
#import "core/config/engine.h"
99

10-
InappReviewPlugin *plugin;
10+
InappReviewPlugin *inapp_review_plugin;
1111

1212
void InappReviewPlugin_init() {
13-
plugin = memnew(InappReviewPlugin);
14-
Engine::get_singleton()->add_singleton(Engine::Singleton("InappReviewPlugin", plugin));
13+
NSLog(@"InappReviewPlugin: Initializing plugin at timestamp: %f", [[NSDate date] timeIntervalSince1970]);
14+
inapp_review_plugin = memnew(InappReviewPlugin);
15+
Engine::get_singleton()->add_singleton(Engine::Singleton("InappReviewPlugin", inapp_review_plugin));
16+
NSLog(@"InappReviewPlugin: Singleton registered");
1517
}
1618

1719
void InappReviewPlugin_deinit() {
18-
if (plugin) {
19-
memdelete(plugin);
20+
NSLog(@"InappReviewPlugin: Deinitializing plugin");
21+
if (inapp_review_plugin) {
22+
memdelete(inapp_review_plugin);
23+
inapp_review_plugin = nullptr;
2024
}
2125
}

ios/script/build.sh

100644100755
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ function generate_godot_headers()
218218

219219
display_status "starting godot build to generate godot headers..."
220220

221-
$SCRIPT_DIR/run_with_timeout.sh -t $BUILD_TIMEOUT -c "scons platform=ios target=template_release" -d ./godot || true
221+
$SCRIPT_DIR/run_with_timeout.sh -t $BUILD_TIMEOUT -c "scons platform=ios target=template_release" -d $GODOT_DIR || true
222222

223223
display_status "terminated godot build after $BUILD_TIMEOUT seconds..."
224224
}
@@ -227,7 +227,7 @@ function generate_godot_headers()
227227
function install_pods()
228228
{
229229
display_status "installing pods..."
230-
pod install --repo-update || true
230+
pod install --repo-update --project-directory=$IOS_DIR/ || true
231231
}
232232

233233

@@ -248,29 +248,29 @@ function build_plugin()
248248
mkdir -p $LIB_DIR
249249

250250
xcodebuild archive \
251-
-project "./$PROJECT" \
251+
-project "$IOS_DIR/$PROJECT" \
252252
-scheme $SCHEME \
253253
-archivePath "$LIB_DIR/ios_release.xcarchive" \
254254
-sdk iphoneos \
255255
SKIP_INSTALL=NO
256256

257257
xcodebuild archive \
258-
-project "./$PROJECT" \
258+
-project "$IOS_DIR/$PROJECT" \
259259
-scheme $SCHEME \
260260
-archivePath "$LIB_DIR/sim_release.xcarchive" \
261261
-sdk iphonesimulator \
262262
SKIP_INSTALL=NO
263263

264264
xcodebuild archive \
265-
-project "./$PROJECT" \
265+
-project "$IOS_DIR/$PROJECT" \
266266
-scheme $SCHEME \
267267
-archivePath "$LIB_DIR/ios_debug.xcarchive" \
268268
-sdk iphoneos \
269269
SKIP_INSTALL=NO \
270270
GCC_PREPROCESSOR_DEFINITIONS="DEBUG_ENABLED=1"
271271

272272
xcodebuild archive \
273-
-project "./$PROJECT" \
273+
-project "$IOS_DIR/$PROJECT" \
274274
-scheme $SCHEME \
275275
-archivePath "$LIB_DIR/sim_debug.xcarchive" \
276276
-sdk iphonesimulator \
@@ -457,7 +457,7 @@ function create_zip_archive()
457457
mkdir -p $tmp_directory/ios/framework
458458
find $PODS_DIR -iname '*.xcframework' -type d -exec cp -r {} $tmp_directory/ios/framework \;
459459

460-
cp $LIB_DIR/$PLUGIN_NAME.{release,debug}.a $tmp_directory/ios/plugins
460+
cp -r $FRAMEWORK_DIR/$PLUGIN_NAME.{release,debug}.xcframework $tmp_directory/ios/plugins
461461

462462
mkdir -p $DEST_DIR
463463

ios/script/fetch_git_repo.sh

100644100755
File mode changed.

ios/script/get_android_dependencies.sh

100644100755
File mode changed.

ios/script/get_config_property.sh

100644100755
File mode changed.

ios/script/get_gradle_property.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)