-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Bug]: iOS crash in Http Plugin #7404
Comments
Can confirm. We're getting the same error when requests get aborted. |
This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. |
Aborted requests also cause hard crashes on iOS, have had to fully disable the HTTP plugin. If you want to reproduce, create a very simple project with CapacitorHTTP wrapping true in the config + Axios + AxiosAbortSignals If you make a request and then cancel it using a signal you get a crash with the error message referring to the fact the request is already cancelled. I've noticed a ton of instability with the CapHTTP plugin in the last couple of releases so it may be an area that needs a bit of love and maybe bolstered testing. |
I created a simple reproduction repository: https://github.com/JosefBredereck/capacitor-issue-7404 |
This issue has been labeled as |
Hello! we have the same problem, this prevents us from using the http plugin completely. |
We are also running into this same problem. |
Hello , We have the same problem. Does deactivating the http plugin temporarily solve your problem? |
Hello @JosefBredereck I created the following file in //
// ExceptionCatcher.h
//
#import <Foundation/Foundation.h>
NS_INLINE NSException * _Nullable tryBlock(void(^_Nonnull tryBlock)(void)) {
@try {
tryBlock();
}
@catch (NSException *exception) {
return exception;
}
return nil;
} In the same folder, I've modified the Just add capacitor/ios/Capacitor/Capacitor/Capacitor.h Lines 1 to 14 in 3c411fd
I then modified these 3 calls by putting them in a tryBlock()
Like this : let exception = tryBlock {
urlSchemeTask.didReceive(data)
} In my case it gives me this error:
I hope I've made myself clear. This avoids the hard crash but in my case I'm looking for a better way to correct it. |
I would like to prevent the modification of remote files in my project. I appreciate the idea but it's not sufficient for our project. |
I'd also like to avoid doing it, but I was able to get more details from my error. In my case, it happens when I close my inappbrowser window from |
same error, any update about this? ty |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Capacitor Version
💊 Capacitor Doctor 💊
Other API Details
Platforms Affected
Current Behavior
We observed an issue on iOS. At random, the app crashes in an Angular application when requests are fired and aborted.
The question remains what exactly causes the issue, we could not create a successful reproduction. Sometimes it happens when a request gets unsubscribed (aborted) and sometimes when the request resolves with an error.
The actual position where the crash happens is
capacitor/ios/Capacitor/Capacitor/WebViewAssetHandler.swift
Line 184 in 3c411fd
Based on https://stackoverflow.com/a/73581176 a possible solution could be to not abort the request like you would in the web environment.
Maybe the solution Flutter has implemented could give a possible direction:
https://github.com/arnaudelub/flutter_polywebview/blob/76def884f29ac13065a538a10789b761c168c5ff/ios/Classes/CustomeSchemeHandler.swift
Expected Behavior
The app does not do a hard crash.
Project Reproduction
Repo: capacitor-issue-7404
Additional Information
No response
The text was updated successfully, but these errors were encountered: