Undecimus: [iOS 11+12] Please fix cydia-no-network error for China devices

Hi, you may not know the fact that iOS asks network permission for an app when it get the first launch on all China device models. Network for that app is not available until user grant the permission.

However, with some reason, after the initial JB, Cydia just get no chance to show that alert. Users can not even find Cydia item in Preferences app. As a result, Cydia just not work after the initial JB.

A workaround is to delete some Network Extensions files or using a VPN to bypass, but that’s very tricky and dirty.

The best method is to call AppWirelessDataUsageManager(link to /System/Library/PrivateFrameworks/Preferences.framework/Preferences) for Cydia explicitly.

code for iOS 11:

NSString *cydiaBundleId = @"com.saurik.Cydia";
[AppWirelessDataUsageManager setAppWirelessDataOption:[NSNumber numberWithInt:3] 
                                      forBundleIdentifier:cydiaBundleId completionHandler:nil];
[AppWirelessDataUsageManager setAppCellularDataEnabled:[NSNumber numberWithInt:1] 
                                       forBundleIdentifier:cydiaBundleId completionHandler:nil];

code for iOS 12:

        Class K_PSAppDataUsagePolicyCache = objc_getClass("PSAppDataUsagePolicyCache");
        PSAppDataUsagePolicyCache *cache = [K_PSAppDataUsagePolicyCache sharedInstance];
        [cache setUsagePoliciesForBundle:@"com.saurik.Cydia" cellular:true wifi:true];

and the entitlements required for iOS 11 & 12:

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
     <dict>
         <key>com.apple.CommCenter.fine-grained</key>
         <array>
             <string>cellular-plan</string>
             <string>data-usage</string>
             <string>data-allowed-write</string>
             <string>preferences-write</string>
         </array>
         <key>platform-application</key>
         <true/>
     </dict>
 </plist>

The code is required to call only once after the initial JB. Could you guys consider adding that piece of code?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 15
  • Comments: 59 (1 by maintainers)

Most upvoted comments

go to /Library/Preferences/, remove com.apple.network*.plist, reboot your device and JB again, Cydia should be able to have internet. This is a workaround for China Models.

README before you try this on iOS12:

Since someone starts acting like a kid giving down thumbs only because my workaround does not work on iOS12…(if you really see the date I post this workaround, there was even no iOS12 JB yet), the workaround I mentioned is only tested on pre-iOS12 devices. and here’s a free new workaround for now: buy a non-China model.

uploaded a new deb with a postinst script which should auto call NetworkFixer for Cydia during installation.

com.laoyur.network-fixer-0.1-2.deb.zip

usage: 0. download com.laoyur.network-fixer-0.1-2.deb.zip 👆, and then rename to com.laoyur.network-fixer-0.1-2.deb(remove the .zip part)

  1. scp deb to your phone
  2. install
  3. enjoy Cydia 😃

@Cryptiiiic @pwn20wndstuff So let me repeat what @laoyur said from an user perspective:

The iPhone sold officially in mainland China has a special feature since iOS 10.3, that when you first time download the app and open it, iOS will prompt a popup to ask you do you wish to allow the app to have internet access. Some iOS built-in apps will also have this popup, like calendar ( I guess they are those apps can be delete and reinstall from AppStore).

Here are some screenshots to help you understand: 1. first time open an app, e.g. the calendar: image

2. in settings -> WLAN, there is a page to list all apps using WLAN & cellular: image

3. if you click: image this is my dev machine, the DPIHelper is my app. You can see there are AppStore and Settings. I didn’t launch calendar app here for the first time when I capture this, so you won’t see it. But I have launched Cydia and make it work, it still not shows Cydia.

4. and if you choose Settings: image

So this is how it looks and functions. I was told this feature is dedicated only for mainland China because laws demand this. It seems like the iOS is reading the iPhone’s hardware info to decide if the phone would have this feature. Only devices with Cellular are impacted. I have WIFI only iPad, which is fine. But I didn’t have a cellular iPad, so I cannot confirm whether Cellular iPad has this feature.

About Cydia:

If you open Cydia for the first time, it will not have the prompt, nor the internet access. It’s not even shown up in the above settings. Just like a ghost. I’m gussing it’s because Cydia is installed in /Applications rather than the AppStore apps path in /var/mobile/...

The current workaround I’m using is to JB and ssh into the device, delete all com.apple.network*.plist in /Library/Preferences and reboot again. Then Cydia will have access to internet, but still not showing up in the settings list.

Note if you upgrade the Cydia bundle, it will be blocked again, and you have to repeat above steps to make it work again.

Hope this can help you understand.

In china mainland, the iphone has a special function. Anyone who need help, please use www.baidu.com, install a software on PC called“爱思助手”, and then install the tweak called “乐网”. and the guide is all over the baidu. Enjoy yourself!

First of all, Chinese people is jailed by their gov. I think they must jailbreak first. lol

@bfrggit com.laoyur.network-fixer.deb.zip

try this one and feedback 😃 remove the .zip file extension before install with dpkg usage: NetworkFixer com.saurik.Cydia

@Orgmist 1- Down File .deb

2-CSP .deb file into the var/mobile path (in fact, anywhere) 2-Use WinSPC no wifi or iPhone Tunnel (Terminal) to Console (shortcut Ctrl + T) and then type the following

3-command: dpkg -i filename.deb

For example install the application abcde.deb dpkg -i abcde.deb

4- Reboot machine -> enjoy Cydia 😃)) Sorry, I’m not good at English. 😦 and the presentation is too long lại please read the above instructions from @laoyur again

@Hdot1 so essentially it’s a way to copy files from your PC to your phone via SSH (secure shell) and “scp” is the terminal command to do so. “deb” stands for debian package and it’s the installation file format for jailbroken iOS used by dpkg. You can switch to a graphical interface by using apps like Cyberduck (if on mac) or WinSCP (Windows). Both should do 😃

@bfrggit com.laoyur.network-fixer.deb.zip

try this one and feedback 😃 remove the .zip file extension before install with dpkg usage: NetworkFixer com.saurik.Cydia

It worked for me.

  • I downloaded the new file and renamed it to remove “.zip”.
  • I SCP-ed it onto the phone.
  • I installed it with dpkg -i.
  • I then ran the command exactly as @laoyur said; note “Cydia” has capital C.
  • Then “Cydia” appears in the list of apps under network settings, and WLAN + Cellular are enabled for it.
  • Cydia works.

@hyl946 Did you try exactly these steps too? What is the output of command NetworkFixer com.saurik.Cydia?

Edit:

  • For @hyl946 I am on 12.1 instead of 12.1.2 so might be different?
  • I cannot really help you debug with the output of the command but I noticed that there were some relevant info there when the command runs… (I did not screenshot sorry…) But the author might be able to help if you provide more details.

@Orgmist unc0ver - settings - check install openssh - hit Jailbreak

I get an error while installing that states” is not a Debian format archive” . Any fixes? And when I try in filza it says command not found.

@bfrggit com.laoyur.network-fixer.deb.zip

try this one and feedback 😃 remove the .zip file extension before install with dpkg usage: NetworkFixer com.saurik.Cydia

Thank you! That worked perfectly!

@laoyur @Kidsmile88 Thanks for the help guys i managed !

@Hdot1 actually you don’t have to connect your phone to the PC; just make sure it’s in the same network as your PC. Also you’ll need to get your phone’s internal IPv4 address, and in WinSCP use that IPv4 for host, “root” for username and “alpine” for password so that the client can correctly identify the host

@Hdot1 if you have Filza installed, you can upload deb via webdav, and then install the deb in Filza

@laoyur 's method works just fine on iOS 12.1.1~12.1.2, across my Chinese region devices, should forget about deleting those plist files.

@laoyur sorry, all of you people are a bit too technical, idk what scp deb is 😦

Never expected such comment on Github.
Anyway, why don’t you google?