Experience sharing: How to debug Mega iOS app on your own device based on Github repo
pmtao opened this issue · comments
Meler Paine commented
The Mega app is great! This issue covers how to debug and run the Mega iOS app on your own device. Anyone who is interested in customizing their own version of the Mega app can find this helpful.
1. Apple developer program
Firstly, you need an apple developer program, not the free version, but the paid one that include iCloud, push notifications, and other capabilities available only in the paid program.
2. Install Xcode and CMake
- Install Xcode in your system.
- Install CMake, and create a symbolic link in folder '/usr/local/bin' after install so that you can run it directly in the Xcode shell:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
3. Clone the repo
Repo link: https://github.com/meganz/iOS
4. Update submodule
- open
.gitmodules
file under repo root directory, and change the URL:
- Change url for karere submodule, use this one: https://github.com/meganz/MEGAchat.git
- Change url for SDK submodule, use this one: https://github.com/meganz/SDK.git
- run command to update:
git submodule update --init --recursive
5. Download 3rdparty packages
- Download the prebuilt third party dependencies from this link: https://mega.nz/file/AENVGYjC#HhUgIOBY69zVZZtOa4e6vdySpHefnUo4GcoQYElmEo4
- Uncompress that file and move the folders
webrtc
,include
andlib
intoiMEGA/Vendor/sdk/bindings/ios/3rdparty
.
6. Modify Xcode project
- Open
iMEGA.xcworkspace
in Xcode, wait Swift Package to update. - Select target MEGA, change Bundle Identifier to your own
com.xxx
, and choose Automatically manage signing with your own account. - Change default App Groups
group.mega.ios
to your own namegroup.com.xxx
, iCloud Containers make the same changeiCloud.com.xxx
. - Do the same for other targets: MEGAPicker, MEGAPickerFileProvider, MEGAShare, MEGANotifications, MEGAWidgetExtension, MEGAIntent.
7. Modify source code
- Modify file
MEGANotifications.entitlements
, delete this line:com.apple.developer.usernotifications.filtering
. - Modify
MEGAConstants.m
change value of MEGAGroupIdentifier to your own group id:group.com.xxx
. - Modify
AppGroupContainer.swift
change value of identifier to your own group id:group.com.xxx
. - Modify
iMEGA/Extensions/MEGAPickerFileProvider/Info.plist
change NSExtensionFileProviderDocumentGroup to your own group id:group.com.xxx
.
8. Run the project with real iPhone device but not the simulator
Running in the simulator will crash when app launch.
Also published here