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
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 and lib into iMEGA/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 name group.com.xxx , iCloud Containers make the same change iCloud.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
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
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install3. Clone the repo
Repo link: https://github.com/meganz/iOS
4. Update submodule
.gitmodulesfile under repo root directory, and change the URL:5. Download 3rdparty packages
webrtc,includeandlibintoiMEGA/Vendor/sdk/bindings/ios/3rdparty.6. Modify Xcode project
iMEGA.xcworkspacein Xcode, wait Swift Package to update.com.xxx, and choose Automatically manage signing with your own account.group.mega.iosto your own namegroup.com.xxx, iCloud Containers make the same changeiCloud.com.xxx.7. Modify source code
MEGANotifications.entitlements, delete this line:com.apple.developer.usernotifications.filtering.MEGAConstants.mchange value of MEGAGroupIdentifier to your own group id:group.com.xxx.AppGroupContainer.swiftchange value of identifier to your own group id:group.com.xxx.iMEGA/Extensions/MEGAPickerFileProvider/Info.plistchange 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.