How to obfuscate Cordova app for ios build? - ios

I want to obfuscate my cordova app for ios build. My android build is automatically obfuscated with R8 tool. I am looking for an open source solution. I have tried using this tool - SiriusObfuscator
But I am getting an error-
$ Obfuscator_2018-04-24_115109 % bin/sirius -projectrootpath /Users/.../MyApp.xcodeproj -obfuscatedproject /Users/.../Desktop
===========================
Welcome to Sirius - Swift Obfuscator
===========================
1) File Extractor:
⠂⠁⠂⠄⡀⢀⠠⠐⠈⠁⠂⠄⡀⢀⠠⠐Extracting⠂⠁⠂⠄⡀⢀⠠⠐⠈⠁⠂⠄⡀⢀⠠⠐
STDERR: /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/vendor/ruby/2.2.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:217:in `initialize_from_file': [Xcodeproj] Unknown object version. (RuntimeError)
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/vendor/ruby/2.2.0/gems/xcodeproj-1.5.3/lib/xcodeproj/project.rb:102:in `open'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/lib/file-extractor/xcodeproj_extractor.rb:10:in `initialize'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/lib/file-extractor/data_extractor.rb:24:in `new'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/lib/file-extractor/data_extractor.rb:24:in `extract_data_from_all_sources'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/lib/file-extractor/data_extractor.rb:11:in `extract_data'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/lib/file-extractor/command.rb:108:in `run'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/vendor/ruby/2.2.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/lib/file-extractor/command.rb:76:in `run'
from /Users/.../Downloads/Obfuscator_2018-04-24_115109/bin/lib/file-extractor/bin/file-extractor:20:in `<main>'
STDOUT:
===========================
2) Symbol Extractor:
⠂⠁⠂⠄⡀⢀⠠⠐⠈⠁⠂⠄⡀⢀⠠⠐Extracting⠂⠁⠂⠄⡀⢀⠠⠐⠈⠁⠂⠄⡀⢀⠠⠐
STDERR: Error during JSON file read
STDOUT: Swift obfuscator symbol extractor tool
My cordova version - 10.0.0
Swift code developed is of 3.x version.
I have also read this SO post where someone pointed how obfuscating only Objective C code will cause issues with Cordova app.
Please help.

Related

Im getting 'Error: PDF could not be generated! Bad CPU type in executable' on my m1 macbook

I have tests with wicked_pdf and wkhtmltopdf-binary. Both gems are installed, but errors dont go away :(
Im tried to install gems with Rosetta, but nothing helps me
error is here
Minitest::UnexpectedError:
RuntimeError: Failed to execute:
["/Users/larkin/.rvm/gems/ruby-2.7.2/bin/wkhtmltopdf", "--lowquality", "--footer-center", "конфіденційно", "--footer-left", "Служба етичного контролю", "--footer-right", "[page] / [topage]", "--footer-font-size", "10", "file:////var/folders/sk/3493jp896vj_spzzn_z2zvkm0000gn/T/wicked_pdf20211129-63903-gn9oc5.html", "/var/folders/sk/3493jp896vj_spzzn_z2zvkm0000gn/T/wicked_pdf_generated_file20211129-63903-urbrlu.pdf"]
Error: PDF could not be generated!
Command Error: /Users/larkin/.rvm/gems/ruby-2.7.2/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf:50:in `exec': Bad CPU type in executable - /Users/larkin/.rvm/gems/ruby-2.7.2/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf_macos_carbon (Errno::EBADARCH)
from /Users/larkin/.rvm/gems/ruby-2.7.2/gems/wkhtmltopdf-binary-0.12.5.4/bin/wkhtmltopdf:50:in `<top (required)>'
from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/wkhtmltopdf:23:in `load'
from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/wkhtmltopdf:23:in `<main>'
from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval'
from /Users/larkin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
The installation/update of Rosetta (on MacOS Monterey 12.2) solved this issue for me with the following command :
softwareupdate --install-rosetta
Maybe it can help others
I had the same issue on macbook with apple m1 chip.
In order to fix that, you need to manually download binary for arm chip, for newest release (0.12.6) just go to: https://github.com/wkhtmltopdf/packaging/releases/0.12.6-1
and download: wkhtmltox-0.12.6-1.macos-cocoa.pkg
Then install script and edit your wicked_pdf.rb file to point to newly installed binary:
WickedPdf.config = {
exe_path: '/usr/local/bin/wkhtmltopdf',
}
You can also do some changes to keep previous behavior on other machines, and use non gem binary only when already installed:
if File.exist?('/usr/local/bin/wkhtmltopdf')
binary_path = '/usr/local/bin/wkhtmltopdf'
else
binary_path = Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf')
end
WickedPdf.config = {
exe_path: binary_path,
}

The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (.../ios/Flutter/Flutter.framework)

After upgrading to flutter version 1.17.4 when running flutter build ios I get following output:
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (.../ios/Flutter/Flutter.framework)
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:590:in `validate_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:158:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error running pod install
What I tried:
Deleting ios/Flutter/Flutter.framework and running pod install as suggested here didn't help
Adding s.static_framework = true to Flutter.podspec - no luck
Deleting-recreating ios folder - no luck
Commenting out use_frameworks! in Podfile - leads to errors in plugins like fatal error: '..._plugin-Swift.h' file not found
I also tried to downgrade the flutter as I didn't have any problem with prev one. But running flutter version v1.17.2 resulted in error:
Error: ProcessException: Process exited abnormally:
error: unsupported sort specification 'creatordate'
I'm stuck with this.
If this issue occured while you trying to implement your own flutter plugin, then simply add this line below dependencies to .podspec
s.static_framework = true
I get same problem with this error output:
[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
(/.../ios/Flutter/Flutter.framework)
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in
verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:595:in `validate_targets'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
I have solved problem with tried this step:
Open your folder ios in your project and open Podfile and you will see code like this:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
You can remove code use_frameworks! and use_modular_headers! and this is complete code:
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
If you have follow instruction you can save change file and hit flutter run
This is complete output:
Running pod install... 3.1s
Running Xcode build...
└─Compiling, linking and signing... 28.0s
Xcode build done. 73.0s
Waiting for iPhone 12 Pro Max to report its views... 19ms
Syncing files to device iPhone 12 Pro Max... 1,218ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on iPhone 12 Pro Max is available at: http://127.0.0.1:50854/VhaUEREqLb0=/
*Disclaimer:
I'm quite new to programming & coding and Flutter is my first programming language. But having struggled with this for 3 days, I believe I have fixed my code. Hoping this helps. Please excuse if this doesn't make sense.
Other Newbies reading this: Do this only if you have a backup of your script, and all of above solutions failed for you.*
Background
My problem occurred when I upgraded Xcode to 12.0.1. Got the same error:
The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
I believe in the upgrade process, some link in an unknown location broke between Flutter, Cocoa-pods & Xcode. I wasn't sure whether something broke internally within my project or within the platforms. Hence, I launched a new flutter project and confirmed it was the latter when that brand new project failed to launch on the Simulator.
Solution
My solution was to rejig the whole platform architecture, rather than re-writing the whole app code.
Step 1: Take a backup of your code (I didn't; got lucky or was just tired with the multiple iterations & backups.)
Step 2: Uninstalled Flutter (Restarted the Mac) and then Reinstalled Flutter on VSCODE
Step 3: Completely Uninstalled Cocoa-pods & Reinstalled Cocoapods. Followed the steps mentioned here.
[Now in your Project]
Step 4: In the terminal, type 'flutter clean' to clean all caches pre-built for the project
Step 5: Delete (or Rename) '/ios' folder (to something else like '/111ios')
Step 6: Recreate a new /ios folder. In the terminal, type
flutter create -i swift
You might need to specify your root PWD for the command to build the ios folder in the right directory.
Step 7: Get packages
flutter pub get
Step 8: Flutter Run.
The above got my boat sailing again. Hopefully this helps the community!

Flutter: Unable to remove custom plugin from being included in ios app

I wrote a custom flutter plugin for windows which works fine so far.
For some reason though, flutter keeps including the plugin in the ios build when I'm trying to run it on the iphone simulator. This causes errors because the plugin doesn't have a ios implementation.
On Android everything works fine.
Here is the plugins pubspec.yaml:
name: fbfunctions
description: A new flutter plugin project.
environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=1.10.0"
dependencies:
flutter:
sdk: flutter
flutter:
plugin:
platforms:
windows:
pluginClass: FbfunctionsPlugin
And here is the error I get when trying to run on the ios simulator:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 2.5s
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (`arm64`)
Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
-> Fetching podspec for `cloud_firestore_web` from `.symlinks/plugins/cloud_firestore_web/ios`
-> Fetching podspec for `cloud_functions` from `.symlinks/plugins/cloud_functions/ios`
-> Fetching podspec for `cloud_functions_web` from `.symlinks/plugins/cloud_functions_web/ios`
-> Fetching podspec for `fbfunctions` from `.symlinks/plugins/fbfunctions/ios`
[!] No podspec found for `fbfunctions` in `.symlinks/plugins/fbfunctions/ios`
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/external_sources/path_source.rb:14:in `block in fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/external_sources/path_source.rb:11:in `fetch'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:980:in `fetch_external_source'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:959:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:958:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:958:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:957:in `fetch_external_sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `10.1` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Error launching application on iPhone 11 Pro Max.
How do I prevent flutter from trying to include the plugin in the ios build?
You can't; currently Flutter expects every plugin to have an iOS podspec. Until that is resolved, the workaround is to include a dummy ios/your_plugin_name.podspec, as you can see in federated flutter/plugins plugins.
You don't need anything in the folder other than the podspec, and once the issue is fixed you can remove it.

Can not generate openaplr.framework in mac by using OpenALPR library

I am using https://github.com/twelve17/openalpr-ios this library to analyse license plate images and get license number from it.
when i try to run ruby script in mac to generate openaplr.framework it gives me error.
This is the error i am getting.
"/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/utils.rb:44:in
execute': Child returned: pid 587 exit 1 (RuntimeError) from
/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/utils.rb:74:inlog_execute'
from
/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/package/automake.rb:141:in
do_autoconf_build' from
/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/package/automake.rb:58:inbuild_arch'
from
/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/package/base.rb:53:in
block in install' from
/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/package/base.rb:52:ineach'
from
/Volumes/DATA/Project_Stuff/openalpr-ios/lib/alpr/package/base.rb:52:in
install' from ./bin/build_frameworks.rb:53:in
Thanks.
I had the same issue and fixed it by comment line:
#opts[:exit_on_error] = true if !opts.has_key?(:exit_on_error)
in file utils.rb line number 24.
System Mac OSX10.10, xCode7.2.1

running bwoken from jenkins

We're trying to set up continuous integration test on our iOS project and running into some issue running broken from Jenkins.
The error we are getting is the following:
iphone Add measurment from CNX.js
/Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script.rb:55:in `run': Test Script Failed (Bwoken::ScriptFailedError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/open3.rb:86:in `popen3'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script.rb:53:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1427:in `to_proc'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/simulator_runner.rb:21:in `each'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/simulator_runner.rb:21:in `execute'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:33:in `execute_for_family'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:28:in `execute_in_simulator'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:27:in `each'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:27:in `execute_in_simulator'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/script_runner.rb:20:in `execute'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/cli/test.rb:105:in `test'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/cli/test.rb:71:in `run'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/lib/bwoken/cli.rb:56
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/bwoken-2.0.0.beta.2/bin/bwoken:3
from /usr/bin/bwoken:19:in `load'
from /usr/bin/bwoken:19
Recording cancelled : At least one target failed to launch; aborting run
Error Domain=com.apple.instruments Code=1 "Error Starting Recording" UserInfo=0x7fa5632b19f0 {NSLocalizedDescription=Error Starting Recording, NSLocalizedRecoverySuggestion=At least one target failed to launch; aborting run}[m
Failed to start trace.[m
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I think the important part is here:
Recording cancelled : At least one target failed to launch; aborting run
mError Domain=com.apple.instruments Code=1 "Error Starting Recording" UserInfo=0x7fa5632b19f0 {NSLocalizedDescription=Error Starting Recording, NSLocalizedRecoverySuggestion=At least one target failed to launch; aborting run}
I can't make sense of it right now, so any help is appreciated.
Thanks, olivier
WE got it running using the jenkins app (https://github.com/stisti/jenkins-app). The issue is related to the fact that Jenkins runs as a deamon and thus does not have access to the window server.
There might be another way around this (changing the Jenkins user type), but running jenkins as an app works for us

Resources