Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
laoyur opened this issue Dec 3, 2018 · 62 comments

Comments

Projects
None yet
@laoyur
Copy link

commented Dec 3, 2018

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?

@waterun

This comment has been minimized.

Copy link

commented Dec 6, 2018

大神说的没错,我最开始从Electra Rollectra,再用Unc0ver越狱,更新过两个插件后,Cydia就没有联网权限了,只能通过ConditionalWifi3来打开,确实这是个问题。如果Pwn能解决就方便了。

@Halo-Michael

This comment has been minimized.

Copy link

commented Dec 6, 2018

非常棒的解决方法 你能fork一下unc0ver并且将其添加进去吗

@liuxuan30

This comment has been minimized.

Copy link

commented Dec 27, 2018

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.

@laoyur

This comment has been minimized.

Copy link
Author

commented Dec 27, 2018

@liuxuan30 thanks, but we are talking about solution rather than workaround here

@liuxuan30

This comment has been minimized.

Copy link

commented Dec 27, 2018

I understand that. and above is just FYI. I hope it can be fixed as well.

@liuxuan30

This comment has been minimized.

Copy link

commented Jan 2, 2019

@laoyur I just tried a new phone, it seems my workaround is not working. any idea?

@laoyur

This comment has been minimized.

Copy link
Author

commented Jan 2, 2019

@liuxuan30 I don't know, the workaround itself is very tricky :(
I will consider forking unc0ver later when I have spare time.

@liuxuan30

This comment has been minimized.

Copy link

commented Jan 2, 2019

after trying reinstall Cydia and deleting those plist several times, it worked again... weird.

But I strongly support you and @pwn20wndstuff and maybe @saurik can help add this. It has been painful for Chinese devices!

@liuxuan30

This comment has been minimized.

Copy link

commented Jan 23, 2019

@Cryptiiiic what more info you need? I'm intersted in this

@Cryptiiiic

This comment has been minimized.

Copy link
Collaborator

commented Jan 23, 2019

@liuxuan30 pwn doesn't fully understand what this is, neither do I.

@laoyur

This comment has been minimized.

Copy link
Author

commented Jan 23, 2019

@Cryptiiiic
Cydia cannot use WLAN/4G after JB on China devices.
Users need to use VPN or other ugly workaround to bypass.
if you can call AppWirelessDataUsageManager related API for Cydia's bundleid after initial JB, this problem can be fixed gracefully.

Hope you can understand now. :)

@liuxuan30

This comment has been minimized.

Copy link

commented Jan 24, 2019

@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.

@JQ555888

This comment has been minimized.

Copy link

commented Feb 7, 2019

Yep. Can confirm all Chinese devices have this issue. Just FYI an indication that the device is a Chinese one is if you go to Settings, in the section where it should say “Wi-Fi”, it shows “WLAN” instead. Also if the device is SIM-compatible, let it be an iPhone or an iPad, in the tab Cellular it gives you the option to choose whether an app can use WLAN or both.

Source: have an iPhone purchased in China and looks like all iDevices whose serials end with CH/A have this problem.

Just want to add that if your device has this issue, using a VPN app that sets up a SOCKS server on localhost may help (possibly). It has to be on localhost so it won’t work if you add a VPN configuration directly in Settings.

Dunno why but /var/preferences/com.apple.networkextension.cache.plist seems to have something to do with it as well. My workaround when this was troubling my iPhone 5S on yalu used to be to SSH into the device first and then rm -rf /var/preferences/com.apple.networkextension.cache.plist, reboot and dang, everything worked. And when this is happening again on unc0ver I was like bugger it and boom, it works. So maybe anyone of greater knowledge than me can look into that file to see what’s going on (not sure whether it’ll be present on non-Chinese devices as well tho).

@JQ555888

This comment has been minimized.

Copy link

commented Feb 7, 2019

In case anyone’s curious about what’s in /var/preferences on a Chinese device, here you go :)

https://drive.google.com/file/d/1-Byz3QcZc3c_jFBqSWTo5ZyO1IJc10Ec/view

The other guy suggested /Library/Preferences which is actually a symbolic link to /var/preferences so we were talking about the same files. The cancerous authority here blocks access to Google so it took me bit of time to upload it but still.

I’m constantly available on Reddit u/Stephen555888 if you have any questions. Worth to mention that I have a Chinese test device so please do contact me if you wish to test anything via VNC or whatever. More than pleased to help.

@JQ555888

This comment has been minimized.

Copy link

commented Feb 9, 2019

Just now I tried out the latest unc0ver v3.0.0 b21, and the new Cydia (1.1.32 b12) seems to have got rid of the problem. I'm not entirely sure though because I can't seem to remember whether I have used ConditionalWiFi on this test device. Yes, Cydia is having internet access now but strange though it's still not showing up in the "Apps Using WLAN & Cellular" section (therefore "weird" because it's not supposed to have internet if it's not showing up there). Probably going to need more people testing this, and btw I didn't test whether Cydia has internet access under Cellular data (currently don't have a compatible SIM with data plan) but can confirm it's working under Wi-Fi.

@liuxuan30

This comment has been minimized.

Copy link

commented Feb 11, 2019

I don't believe it has been resloved under WIFI without any reply from Saurik nor the authors.

@vcarus

This comment has been minimized.

Copy link

commented Feb 17, 2019

Encounter the same issue here on my Chinese Models of iPhone X.
All apps run as root involved.

@CoolPersonMaam

This comment has been minimized.

Copy link

commented Feb 19, 2019

Get a VPN and then try it see if it works
If it doesn’t move out of China

@JQ555888

This comment has been minimized.

Copy link

commented Feb 19, 2019

@CoolPersonMaam Well the issue is not about bypassing their shitass firewall. Apple implemented a fucking nasty on device feature that limits per app network usage to comply with the motherfucker authority's requests. I'd wish to leave the goddamn country but that wouldn't solve the issue.

Edit: was drunk and sorry for the swear words. loathe the way the government does things so bad I couldn't help it.

@laoyur laoyur changed the title Please fix cydia-no-network error for China devices [iOS 11+12] Please fix cydia-no-network error for China devices Feb 23, 2019

@laoyur

This comment has been minimized.

Copy link
Author

commented Feb 23, 2019

Code for iOS 12 updated.

We can make a NetworkFix.deb and people can scp it to the device and then exec for Cydia.
But I do hope unc0ver can embed the deb as built-in resource and call NetworkFix for Cydia during initial JB.
It will help a lot of ordinary people living in China.

@JQ555888

This comment has been minimized.

Copy link

commented Feb 23, 2019

OP has edited the main post to reflect the changes required for Cydia to properly support networking. This probably needs modifications in the source code for Cydia.app, so maybe @saurik could you please look into this?

The reasoning is that if this can be done within Cydia, the only thing needed is to push an update to Cydia Installer and problem solved for not only devices running unc0ver, but also the previous jailbreaks.

@DerackHJ

This comment has been minimized.

Copy link

commented Feb 25, 2019

@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.

Tried this method with the latest release on iOS12, didn't work.

@JQ555888

This comment has been minimized.

Copy link

commented Feb 25, 2019

@DerackHJ

Might want to specify where you were stuck at a bit. Just saying it doesn’t work doesn’t help anything.

Also after deleting the preferences files in /var/preferences and the reboot, you might have to go to settings to manually enable network access for Cydia. It’s not going to work if you directly open Cydia without choosing that “Allow WLAN and Cellular”. Hope everything will work out for you :)

If it’s still not working, could you kindly please detail a little more on the steps you did. That may help a lot.

@bfrggit

This comment has been minimized.

Copy link

commented Mar 7, 2019

This seems to be the oldest open issue as of now but still unresolved after several months.

I confirm the problem still persists with iOS 12.1 on iPhone 6 with unc0ver v3.0.0%b42.

Symptoms: Cydia does not connect; network permission dialog does not pop up; no "Cydia" in network settings (under Cellular where you can assign network access for apps).

What is worse is that the removing plist trick does not work either @JQ555888.
By "no working" I mean, after deleting those files (and with or without rebooting) --
Cydia still fails connection;
Network permission dialog still does not pop up;
Cydia is still not in network settings so I cannot allow it manually either.

Tried multiple times, no luck.

Installing @laoyur Network Fix deb files does not seem to have any effect either (his fork of unc0ver does not support iOS 12 so I tried to install the deb file with dpkg).

@bfrggit

This comment has been minimized.

Copy link

commented Mar 7, 2019

Restoring network settings does not seem to have any effect.
Reinstalling Cydia does not seem to have any effect, even combined with deleting the plist files or restoring network settings or installing @laoyur deb file.

@laoyur

This comment has been minimized.

Copy link
Author

commented Mar 7, 2019

@bfrggit the deb in my fork is for iOS 11 only -- I haven't update it with iOS 12 support
I will upload a new version later.

@JQ555888

This comment has been minimized.

Copy link

commented Mar 10, 2019

@hyl946 yep that’s exactly what happens when you’ve been staying in China for a prolonged period of time. Can’t be more bothered by the stupidity of their govt. Sorry if I sounded rude, but I’m really not in the mood the moment I commented, especially when most people replying to this topic are saying nonsense and just don’t get the actual issue here. Glad to help if it’s still not working for you on iOS 12. Maybe somehow you missed the steps. Please provide more information so that we can help you.

@JQ555888

This comment has been minimized.

Copy link

commented Mar 10, 2019

Currently on Build 16C50 and I believe 16C101 & 16C104 should work as well.
9031488B-2F1C-4CAC-AC83-C466F5E9F54D
B2BAA31E-C45F-4C80-9E02-BE1C046D30AA

@hyl946

This comment has been minimized.

Copy link

commented Mar 10, 2019

@JQ555888 Already solved, thank you

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

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

@DerackHJ

This comment has been minimized.

Copy link

commented Mar 12, 2019

@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?

@DerackHJ

This comment has been minimized.

Copy link

commented Mar 12, 2019

@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.

@JQ555888

This comment has been minimized.

Copy link

commented Mar 12, 2019

@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 :)

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

@JQ555888 so I download WinSCP, connect my iPhone to my pc and paste ‘https://github.com/pwn20wndstuff/Undecimus/files/2948085/com.laoyur.network-fixer-0.1-2.deb.zip’ into the WinSCP??

@laoyur

This comment has been minimized.

Copy link
Author

commented Mar 12, 2019

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

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

@laoyur do I download Filza off safari? What’s webdev?

@JQ555888

This comment has been minimized.

Copy link

commented Mar 12, 2019

@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

This comment has been minimized.

Copy link

commented Mar 12, 2019

@JQ555888 IPv4? So once the host has been identified I just paste that code into it or something?😂

@JQ555888

This comment has been minimized.

Copy link

commented Mar 12, 2019

@Hdot1 Yeah that’s pretty much it. Just enter the IPv4 string in the text box for “host”

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

@JQ555888 much appreciated

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

@JQ555888 idk what ipv4 is, i thought it was the ip address of my network that everything is connected to

@Hdot1

This comment has been minimized.

Copy link

commented Mar 12, 2019

@laoyur how do i use filza i have it downloaded from tweekbox ios 12

@laoyur

This comment has been minimized.

Copy link
Author

commented Mar 13, 2019

@Hdot1 Filza - Preferences - Enable WebDav server - browse PHONE_IP:11111 on your PC - upload deb file to /var/mobile - install deb file in Filza

@Kidsmile88

This comment has been minimized.

Copy link

commented Mar 15, 2019

I am Vietnamese. I bought a Chinese iphone during a trip in China.
And I'm also having this problem. Perhaps buying an iphone in China is a mistake My device is in ios 12.1 😁

. Have you fixed the error? @Hdot1

@Orgmist

This comment has been minimized.

Copy link

commented Mar 18, 2019

@laoyur the trouble i'm having is my iphone doesnt have "Open SHH" installed because Cydia dosent have a network connection to download it. How else can i enable my SHH so when i open WinSCP it can find my device ?

@laoyur

This comment has been minimized.

Copy link
Author

commented Mar 19, 2019

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

@Orgmist

This comment has been minimized.

Copy link

commented Mar 19, 2019

@laoyur Thank you, ive copied the file into my temp folder, now how can i install it ? i pressed CTRL T then what ?

@Kidsmile88

This comment has been minimized.

Copy link

commented Mar 19, 2019

@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

@Orgmist

This comment has been minimized.

Copy link

commented Mar 19, 2019

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

@Kidsmile88

This comment has been minimized.

Copy link

commented Mar 19, 2019

@Orgmist
Chúc mừng bạn !
🤗

@cirnoingensoukyou

This comment has been minimized.

Copy link

commented Mar 25, 2019

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

@Kidsmile88

This comment has been minimized.

Copy link

commented Apr 9, 2019

long time no one cared about this problem. I don't know if any official bug fixes have been released for "ordinary people" in China. ??? I look forward to it even though I'm not a Chinese citizen. I'm sorry if I bother people again for this comment. 😊

@zekunyan

This comment has been minimized.

Copy link

commented Apr 26, 2019

I have the same problem...

@OldTiger

This comment has been minimized.

Copy link

commented Apr 30, 2019

IOS12.1 Solution

  • 步驟1. cd「/var/preferences」資料夾內

  • 步驟2. 找到底下三個檔案刪除,刪除前可先備份一次,這三個檔案重開機會自動重新產生。
    com.apple.networkextension.plist、com.apple.networkextension.cache.plist、com.apple.networkextension.necp.plist

  • 步驟3. 最後在刪除三個檔案後,「cinditionalwifi3」插件安裝後就能完美改善此問題。

@laoyur laoyur closed this Apr 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.