network.request 无法通过 SDK 版本 2024.3706 在 Android 上运行

问题描述 投票:0回答:1

我已经尝试了很多方法来解决通过http URL(服务器)的network.request问题,但我仍然没有 现在工作。

请提供任何反馈来解决此错误(event.status = -1)

非常感谢!

1.更新了SDK版本为最新。 2.设置native.setProperty("http.keepAlive", "false") 。 3.尝试 https://www.google.com/ 有效,但在 http url 上无效。

android http networking request
1个回答
0
投票

首先,非常感谢您的反馈。

这是构建设置。

设置= { 方向= { 默认=“肖像”, 支持= { “肖像”,“肖像颠倒”, }, }, 机器人 = { 使用权限 = { -- MapView 需要从 Google 地图服务器获取其内容。 “android.permission.INTERNET”,

        -- Optional permission used to display current location via the GPS.
        "android.permission.ACCESS_FINE_LOCATION",

        -- Optional permission used to display current location via WiFi or cellular service.
        "android.permission.ACCESS_COARSE_LOCATION",
        "com.google.android.c2dm.permission.RECEIVE",

        -- Optional permission used to take photo and save to device
        "android.permission.CAMERA",
        "android.permission.WRITE_EXTERNAL_STORAGE",
    },
    usesFeatures =
    {
        -- If you set permissions "ACCESS_FINE_LOCATION" and "ACCESS_COARSE_LOCATION" above,
        -- then you may want to set up your app to not require location services as follows.
        -- Otherwise, devices that do not have location sevices (such as a GPS) will be unable
        -- to purchase this app in the app store.
        { name = "android.hardware.location", required = false },
        { name = "android.hardware.location.gps", required = false },
        { name = "android.hardware.location.network", required = false },
        { name = "android.hardware.camera", required = true },
        { name = "android.hardware.camera.front", required = false },
    },
},
iphone =
{
    xcassets = "Images.xcassets",
    plist=
    {
        UIPrerenderedIcon = true,
        UIStatusBarHidden = false,
        UILaunchStoryboardName = "LaunchScreen",
        ITSAppUsesNonExemptEncryption = false, -- This application doesn't use custom encryption
        
        NSCameraUsageDescription = "This app would like to access the camera.",
        
        NSPhotoLibraryUsageDescription = "This app would like to access the photo library.",
        NSPhotoLibraryAddUsageDescription = "This app would like to add the photo library.",
        --Here is the settings for google map 
        NSLocationAlwaysUsageDescription = "This app would like to use location services.",
        NSLocationWhenInUseUsageDescription = "This app would like to use location services.",
        NSAppTransportSecurity =
        {
            NSExceptionDomains =
            {
                ["coronalabs.com"] =
                {
                    NSIncludesSubdomains = true,
                    NSThirdPartyExceptionAllowsInsecureHTTPLoads = true
                },
                ["youtube.com"] =
                {
                    NSIncludesSubdomains = true,
                    NSThirdPartyExceptionAllowsInsecureHTTPLoads = true
                },
                ["google.com"] =
                {
                    NSIncludesSubdomains = true,
                    NSThirdPartyExceptionAllowsInsecureHTTPLoads = true
                },
            },
        },

    },
},
plugins =
{
    ["CoronaProvider.native.popup.activity"] =
    {
        -- required
        publisherId = "com.coronalabs",
        supportedPlatforms = { iphone = true },
    },
    ["CoronaProvider.native.popup.social"] =
    {
        -- required
        publisherId = "com.coronalabs",
        supportedPlatforms = { android = true },
    },
    ["plugin.utf8"] =
    {
        publisherId = "com.coronalabs"
    },
    
},  
window =
{
    titleText =
    {
        default = "Camera",
    },
},
NSAppTransportSecurity =
        {
            NSExceptionDomains =
            {
                ["fetdms.ddns.net"] =
                {
                    NSIncludesSubdomains = true,
                    NSThirdPartyExceptionAllowsInsecureHTTPLoads = true,
                    NSExceptionRequiresForwardSecrecy = false,
                    NSThirdPartyExceptionRequiresForwardSecrecy = false,
                    NSRequiresCertificateTransparency = false,
                },

                
            },
        },

}

© www.soinside.com 2019 - 2024. All rights reserved.