How to obfuscate code using Polidea's iOS Class Guard? - ios

Can any one tell me the steps to implement Polidea's iOS Class Guard in iOS project. I have gone through the following github link:
https://github.com/Polidea/ios-class-guard
I also gone through sample project. I only find a obfuscate_project file in it. How can I test after implementing this?

4.1.1.1. Installation
Execute this simple bash script in Terminal. When asked for the password, enter your account. It's needed because the utility is installed in /usr/local/bin.
$ brew install https://raw.githubusercontent.com/Polidea/homebrew/ios-class-guard/Library/Formula/ios-class-guard.rb
To install bleeding edge version:
$ brew install --HEAD https://raw.githubusercontent.com/Polidea/homebrew/ios-class-guard/Library/Formula/ios-class-guard.rb
4.1.1.2. How to use it?
A few steps are required to integrate iOS Class Guard in a project.
Download obfuscate_project into your project root path.
$ chmod +x obfuscate_project
Update the project file, scheme and configuration name in shell script obfuscate_project.sh .
Do
$ ./obfuscate_project
every time when you want to obfuscate your project. It should be done every release. Store the json file containing symbol mapping so you can get the original symbol names in case of a crash. **Rename stored json file with release version number. **
Build, test and archive your project using Xcode or other tools.
The presented way is the simplest one. You can also add an additional target that will automatically regenerate the symbols map during compilation.
ios-class-guard will be called by shell script obfuscate_project.
============Unfortunately =============
In XCode 7.0 enviorment, we can't finish obfuscating without errors.

Related

Using ZMQ on iOS

I am trying to build an iOS app that is exposed to a fairly extensive Rust project, but I am having issues with one of the dependencies in the project. The Rust project has a ZMQ dependency, and while I am able to build the project on my Mac, when I try to incorporate the Rust project I get the following error:
error: failed to run custom build command for `zmq-sys v0.8.3`
Caused by:
process didn't exit successfully: `/Users/lisa/company/project/project_detail/target/debug/build/zmq-sys-16dfc88dff84d855/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=LIBZMQ_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-apple-ios
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_apple_ios
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-apple-ios
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_apple_ios
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-apple-ios
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_apple_ios
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'Unable to locate libzmq:
pkg-config has not been configured to support cross-compilation.
Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.', /Users/lisa/.cargo/registry/src/github.com-1ecc6299db9ec823/zmq-sys-0.8.3/build.rs:31:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
I am trying to build the appropriate library for the iOS and iOS simulator architectures without relying on pkg-config, but if someone can provide useful instructions for configuring pkg-config for cross-compilation, I am not opposed to it, I just don't know how and can't find any up to date resources.
I have cloned the libzmq project from this github: https://github.com/zeromq/libzmq.git, then navigate into libzmq.
Inside libzmq, I run ./autogen.sh followed by ./configure --prefix [directory location] --target "aarch64-apple-ios", then make and make install.
The above procedure without the --target flag is how I got the project to compile on my Mac in the first place, and with the target flag in place make and make install both complete successfully, but when I try to build the project using PROJECT_DIR="${PWD}/ProjectName" ./ProjectName/build-rust.sh,
I get the previously posted error.
I am following the Swift-Bridge Book (https://chinedufn.github.io/swift-bridge/building/xcode-and-cargo/index.html) to try to load the Rust libraries into Xcode.
One thing to note: In the libzmq git hub, there is a folder called builds/ios/ and inside this folder is what looks to be a build file for all of the iOS archs, but I haven't been able to get the repo to build with that file. I think figuring out how to use the build_ios.sh build file as opposed to the standard build.sh provided might be the answer, but I've tried dropping build_ios.sh where build.sh is, and ./autogen.sh doesn't work, because it complains that it can't find configure.ac, even though this file does exist.

ionic build ios fails with "[TypeError: Arguments to path.join must be strings]"

I am trying to create an ionic app on Mac.
I followed the instructions on ionic's website to create a basic app and was able to run it in the browser but when I run "ionic build ios" I get following error. I cannot find a log file or any other error to debug this. How do I go about fixing this?
Check your Gulp version and gulpfile.js. You may need to remove the calls to gulp.src
See:
Gulp TypeError: Arguments to path.join must be strings
and
https://github.com/sindresorhus/gulp-ruby-sass/issues/191
ok, after lot of looking and searching I figured my npm install was messed up.
Part of my installs were in /usr/local and few of them were in /User/user.name/npm folders. /Users/user.name/npm was set in the npm config prefix.
I had two installs of cordova, one on each folder above. Some how the cordova from /usr/local was getting used to create the project and that was the old version.
To fix the problem, I uninstalled all my global npm installs and pointed my npm config prefix to /usr/local and gave myself execute permission on that folder. Everything is working now.
Here is the video that explains how to do it: https://docs.npmjs.com/getting-started/fixing-npm-permissions

Cordova and ios-deploy causes builds to fail with "codesign exit code 1"/ "permission denied"

I'm working on a Cordova based mobile application, and wanted to make use of the Cordova CLI's ability to deploy and run my mobile app right from the command line, without having to go into XCode to do the build
When doing:
cordova run ios --device
Cordova graciously tells you that you should install the ios-deploy node module. I did so following the steps on their GIT site.
When I next tried to do a run, I started to get codesign errors, specifically:
/Users/blahblah/platforms/ios/build/device/myApp.app: Permission denied
Command /usr/bin/codesign failed with exit code 1
I couldn't get the code signing to work from Terminal, and worse, going back into XCode resulted in the same error!
Fortunately the error messages says it all: permission denied; I was able to correct this by popping back into Terminal and running a chmod on my entire app folder, i.e.:
chmod -R a+rwx myApp
I could then go back into XCode and get the project building and deploying again (whew!), however if I tried to do the deploy via the Cordova CLI, then same issue would occur.
It seems like the ios-deploy and / or cordova is messing around with the folder permissions, but I'm not sure how to correct this.
Any suggestions would be appreciated!
UPDATE:
To be clear, I am able to successfully sign the app within XCode if I first go into Terminal, and then into the platforms/ios folder and perform a chmod -R a+rwx on the "www" folder.
The problem I'm having is trying to get this to build / sign successfully from the command line.
I've done some further diagnosis, and it seems that the problem is with the Cordova CLI itself, and not with ios-deploy; when I execute:
cordova prepapre
It copies my "www" folder over to the "platforms/ios/www", however it changes the permissions when doing so from everyone having write access (i.e.: drwxrwxrwx) to only my user having write access i.e.: (drwxr-xr-x)
It seems that this is fouling up the codesign application, and is causing my permission denied errors above.
I'm just hoping someone knows how I can work around this, or what I might be doing wrong with my build - I'd prefer not to have to go into XCode to do these builds.
So it turns out that the Cordova CLI is working just fine, as is the ios-deploy npm package.
The problem turns out to be within the solution itself, and has nothing to do with the tools.
I am using the Ionic framework within this particular Cordova application, and their framework installs some "after_prepare" hooks (within the hooks folder) which attempt to help prepare / clean up some extraneous files prior to the build.
One of these hooks (named "020_remove_sass_from_platform.js") was trying to help out by cleaning up unneeded SASS files prior to the build in order to reduce the size of the compiled app.
Unfortunately this hook was adjusting the folder permissions (I guess in order to ensure the delete could succeed), and this was the cause of the "www" folder's permissions changing during a "cordova prepare".
I deleted the hooks, and now the Cordova CLI builds and signs the APK as expected, and the ios-deploy package pushes it to the device, all without using XCode.
Hope this can be of some help to someone else.
Check the CODE_SIGN_IDENTITY property in your build settings. Is your provisioning profile selected there?
You also need to enter a valid bundle identifier in your apps .plist.
The identifier has to match the one you provided when generating the profile.
Try this
sudo npm install -g ios-deploy --unsafe-perm

How to remove app-engine plugin from Grails project

I develop project named
MyProject
. I made a copy of this project -
MyProject.zip
I wanted to to use
app-engine
plugin, so I installed it and I got an error:
No Google AppEngine SDK specified. Either set APPENGINE_HOME in your
environment or specify google.appengine.sdk in your
grails-app/conf/BuildConfig.groovy file
Doesn't matter. Now, I do not want to use this plugin. Whatever I do, it prints me this same error. I removed project and I extracted my zip file.
Still, is the same problem. Could you explain, how to remove permanently plugin from grails? I use MacOS
Thanks
Try to remove project copy from .grails:
rm -rf ~/.grails/%GRAILS VERSION%/projects/MyProject

Building WebRtc on iOS

I was successfully able to build WebRTC on MAC following these instructions: http://www.webrtc.org/reference/getting-started
Has anyone successfully built it on iOS? I understand that someone (arik) has successfully built it on iOS: https://groups.google.com/forum/#!msg/discuss-webrtc/VJg-fk2-i_0/dtG200DOzsgJ But the steps are not clear.
Can someone (who built on ios) summarize the steps so that it will be useful for everyone trying it in the future?
I wrote a detailed blog post with all of the instructions on how to build the WebRTC example iOS application, as well as how to run it on the iOS simulator or an actual iOS device. You can take a look here to read the details, it's a pretty lengthy process.
Yes, compiling for iOS was a very painful task... especially getting it work in Xcode.
Here's my attempt to get AppRTC Demo for ios
Clone/Pull: https://github.com/pristineio/webrtc-build-scripts
After getting the repo, then open the xcode project within the ios directory. Set the target to WebRTC Dance, then execute. At this point the scripts will update depot_tools and do all the dirty work (pull, modify, build) so that your target for AppRTCDemo will able to resolve the missing files and execute.
Once that completes, you can change the target to AppRTC Demo with a simulator or a real device, click run and it should execute. There's more detailed information in the guide linked in there and updates in the readme.
If you are wondering what gets ran under the hood, check out the build.sh file in the ios directory of the git repo. The dance function is what's actually getting executed for you when you select WebRTC Dance.
Its not really easy to describe the build process (way too much going on) but the build scripts repo should definitely point you in the right direction and help you get AppRTCDemo on ios 'just work'
There's also a google developers video posted here, where they try and break down the build process so you can build for ios (the youtube title is misleading).
Also, I just added cocoapods support for ios webrtc, add this to your Podfile,
pod "libjingle_peerconnection"
# Add this to the bottom so it won't have issues with active architecture
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['VALID_ARCHS'] = ['armv7', 'i386']
end
end
end
Not all the revisions are built, so check out the the cocoadocs for which revisions are available
I have been working in this space for the past few months now - webrtc on iOS is not easy. To help this problem I have added a github repo with a working example of and iOS app using webrtc.
https://github.com/gandg/webrtc-ios
The site references the google code site as well, so it should be a helpful starting point.
Well, it's been a long time to answer this post. But, I hope someone might
get better intuition from it.
I have been dealing with webrtc compilation processes for iOS and Android platforms. This process is really simple if you follow each step efficiently. To compile the library for iOS, follow the below-given commands and make sure you're using the same(only-1) tab of Mac terminal for WebRTC Native Compilation Setup as follows:
Prerequisites
Link Xcode with Command line
Setup depot_tools
Fetch Code for Development
Selection of Branch
Compile Library (iOS Framework)
1. Prerequisites:
First of all, make sure of the following things that you have already installed, if not then use these commands to do that:
- sudo add-apt-repository ppa:openjdk-r/ppa
- sudo apt-get install openjdk-8-jdk
- sudo apt-get install pkg-config
- sudo apt-get update
Please also install python==2.7, if it's not already installed.
2. Link Xcode with Command line:
- sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- sudo xcode-select --switch /Library/Developer/CommandLineTools
3. Setup the Depot_tools:
- git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
- export PATH="$PATH:${HOME}/depot_tools"
After that, start the following steps one by one. Every step takes its own time based on the machine specs and internet speed, so make sure every step is completed without interruption.
4. Fetch Code:
- mkdir webrtc_ios
- cd webrtc_ios
- fetch --nohooks webrtc_ios
- gclient sync
5. Select Branch-head:
- cd src
- ./build/install-build-deps.sh
- git checkout origin/master
- git branch
6. To compile every time:
Make sure you are in the webrtc_ios/src/ directory, then simply run this command:
- ./tools_webrtc/ios/build_ios_libs.sh
It turns out that you will end up with the compilation and building of WebRtc Framework holding Webrtc Header Files. You can simply drag and drop this framework into your Xcode production environment or simply import it.
As you have set up your compilation environment, now every time you make changes into your native stack, you can simply run this command ./tools_webrtc/ios/build_ios_libs.sh to generate an updated framework.
If you end up with an issue regarding the compilation of webrtc framework. Please follow these steps. Make sure you're in this directory webrtc_ios/src/:
- git checkout origin/master
# To make sure you're using origin/master
- git branch
- gclient revert
- gclient sync
- ./tools_webrtc/ios/build_ios_libs.sh
And hopefully, you will have your issues sorted. I always recommend you guys that You can check out a branch that would be behind the origin/master and doesn't have all dependencies and modules over there which are necessary to build webrtc framework for iOS. So, Please always checkout to branch/head of webrtc native stack
Now, if you tried with these both procedures to build the WebRTC such as:
1- Using Bash Build Tools (./tools_webrtc/ios/build_ios_libs.sh)
2- Using Manual Compilation
Examples
$ # debug build for 64-bit iOS
$ gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64"'
$ # debug build for simulator
$ gn gen out/ios_sim --args='target_os="ios" target_cpu="x64"'
2.1- Compiling (ninja -C out/Debug)
Both procedures will work.
This seems to build some of the modules: https://code.google.com/p/webrtc/issues/detail?id=1421#makechanges

Resources