Skip to content

Commit 6db813a

Browse files
committed
Merge branch 'master' of https://github.com/Instabug/instabug-reactnative into hotfix/fix_crash_for_ios_8
2 parents 0f43c93 + 851b51f commit 6db813a

File tree

4 files changed

+64
-11
lines changed

4 files changed

+64
-11
lines changed

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ - (dispatch_queue_t)methodQueue {
229229
[Instabug identifyUserWithEmail:email name:name];
230230
}
231231

232-
RCT_EXPORT_METHOD(logout) {
232+
RCT_EXPORT_METHOD(logOut) {
233233
[Instabug logOut];
234234
}
235235

link.rb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,46 @@
55
puts('xcodeproj doesn\'t exist')
66
Kernel.exit(0)
77
end
8-
require 'fileutils'
98

109
# Replace these with your values
1110
current_path = Dir.pwd
1211
project_path = Dir.glob("#{current_path}/ios/*.xcodeproj").first
1312
file_name = File.basename(project_path, ".xcodeproj")
14-
project_location = './ios/'+file_name+'.xcodeproj'
13+
project_location = "./ios/#{file_name}.xcodeproj"
1514
target_name = file_name
1615
framework_root = '../node_modules/instabug-reactnative/ios'
1716
framework_name = 'Instabug.framework'
1817

1918
INSTABUG_PHASE_NAME = "Strip Frameworks"
19+
2020
INSTABUG_PHASE_SCRIPT = <<-SCRIPTEND
2121
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Instabug.framework/Instabug.bundle/strip-frameworks.sh"
2222
SCRIPTEND
2323

2424
# Get useful variables
2525
project = Xcodeproj::Project.open(project_location)
2626
frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' }
27-
if frameworks_group == nil
28-
frameworks_group = project.new_group('Frameworks')
29-
end
27+
frameworks_group ||= project.new_group('Frameworks')
3028
target = project.targets.find { |target| target.to_s == target_name }
3129
frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' }
3230

3331
# Add new "Embed Frameworks" build phase to target
32+
embed_frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'Embed Instabug Framework'}
33+
Kernel.exit(0) if embed_frameworks_build_phase
3434
embed_frameworks_build_phase = project.new(Xcodeproj::Project::Object::PBXCopyFilesBuildPhase)
35-
embed_frameworks_build_phase.name = 'Embed Frameworks'
35+
embed_frameworks_build_phase.name = 'Embed Instabug Framework'
3636
embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks
37-
target.build_phases << embed_frameworks_build_phase
37+
target.build_phases << embed_frameworks_build_phase
3838

3939
# Add framework search path to target
4040
['Debug', 'Release'].each do |config|
41-
paths = ['$(inherited)', framework_root]
42-
target.build_settings(config)['FRAMEWORK_SEARCH_PATHS'] = paths
41+
framework_search_paths = target.build_settings(config)['FRAMEWORK_SEARCH_PATHS']
42+
43+
framework_search_paths ||= ['$(inherited)']
44+
framework_search_paths = [framework_search_paths] unless framework_search_paths.is_a?(Array)
45+
framework_search_paths << framework_root unless framework_search_paths.include? framework_root
46+
47+
target.build_settings(config)['FRAMEWORK_SEARCH_PATHS'] = framework_search_paths
4348
end
4449

4550
# Add framework to target as "Embedded Frameworks"
@@ -48,6 +53,7 @@
4853
frameworks_build_phase.add_file_reference(framework_ref)
4954
build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] }
5055

56+
5157
#Add New Run Script Phase to Build Phases
5258
phase = target.new_shell_script_build_phase(INSTABUG_PHASE_NAME)
5359
phase.shell_script = INSTABUG_PHASE_SCRIPT

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
2424
"rnpm": {
2525
"commands": {
26-
"postlink": "ruby ./node_modules/instabug-reactnative/link.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\""
26+
"postlink": "ruby ./node_modules/instabug-reactnative/link.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\"",
27+
"preunlink": "ruby ./node_modules/instabug-reactnative/unlink.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\""
2728
},
2829
"android": {
2930
"packageInstance": "\t\tnew RNInstabugReactnativePackage.Builder(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this)\n\t\t\t\t\t\t\t.setInvocationEvent(\"shake\")\n\t\t\t\t\t\t\t.setPrimaryColor(\"#1D82DC\")\n\t\t\t\t\t\t\t.setFloatingEdge(\"left\")\n\t\t\t\t\t\t\t.setFloatingButtonOffsetFromTop(250)\n\t\t\t\t\t\t\t.build()"

unlink.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env ruby
2+
begin
3+
require 'xcodeproj'
4+
rescue LoadError
5+
puts('xcodeproj doesn\'t exist')
6+
Kernel.exit(0)
7+
end
8+
9+
# Replace these with your values
10+
current_path = Dir.pwd
11+
project_path = Dir.glob("#{current_path}/ios/*.xcodeproj").first
12+
file_name = File.basename(project_path, ".xcodeproj")
13+
project_location = "./ios/#{file_name}.xcodeproj"
14+
target_name = file_name
15+
framework_root = '../node_modules/instabug-reactnative/ios'
16+
framework_name = 'Instabug.framework'
17+
18+
INSTABUG_PHASE_NAME = "Strip Frameworks"
19+
20+
# Get useful variables
21+
project = Xcodeproj::Project.open(project_location)
22+
frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' }
23+
target = project.targets.find { |target| target.to_s == target_name }
24+
frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' }
25+
26+
# Remove "Embed Frameworks" build phase to target
27+
embed_frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'Embed Instabug Framework'}
28+
Kernel.exit(0) unless embed_frameworks_build_phase
29+
target.build_phases.delete(embed_frameworks_build_phase)
30+
31+
# Remove framework search path from target
32+
['Debug', 'Release'].each do |config|
33+
target.build_settings(config)['FRAMEWORK_SEARCH_PATHS'].delete(framework_root)
34+
end
35+
36+
# Remove framework from target from "Embedded Frameworks"
37+
framework_ref = frameworks_group.files.find { |file_reference| file_reference.path == "#{framework_root}/#{framework_name}"}
38+
frameworks_build_phase.remove_file_reference(framework_ref)
39+
framework_ref.remove_from_project
40+
41+
#Delete New Run Script Phase from Build Phases
42+
shell_script_build_phase = target.shell_script_build_phases.find { |build_phase| build_phase.to_s == INSTABUG_PHASE_NAME }
43+
target.build_phases.delete(shell_script_build_phase)
44+
45+
# Save Xcode project
46+
project.save

0 commit comments

Comments
 (0)