Мое приложение для iOS Flutter заблокировано от достижения локального сервера вашего MacIOS

Программируем под IOS
Ответить Пред. темаСлед. тема
Anonymous
 Мое приложение для iOS Flutter заблокировано от достижения локального сервера вашего Mac

Сообщение Anonymous »

Мое приложение для iOS Flutter заблокировано от достижения локального сервера моего Mac по адресу 192.168.1.170:8181. Я могу сгибаться от своего iPhone до локального сервера моего Mac, и я также могу добраться до документов Swagger. Однако, когда я пытаюсь нажать на URL из приложения, я получаю ошибку «без хоста». Я проверяю подобные проблемы, такие как реализация бэкэнд .NET. Это не решило мою проблему. Это физическое устройство по сравнению с Wi -Fi, подключенным через одну и ту же сеть. Это iPhone 12 Pro IOS версия 18.6. Когда я запускаю приложение, я предоставляю сетевые разрешения и до сих пор не ходи. Мне нужна помощь, чтобы решить проблему с сетью между двумя устройствами. < /P>
Podfile: < /p>
# Uncomment this line to define a global platform for your project
platform :ios, '15.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# You can remove unused permissions here
# for more information: https://github.com/BaseflowIT/flutter-p ... lerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',

## dart: PermissionGroup.calendar
##'PERMISSION_EVENTS=1',

## dart: PermissionGroup.calendarFullAccess
#'PERMISSION_EVENTS_FULL_ACCESS=1',

## dart: PermissionGroup.reminders
#'PERMISSION_REMINDERS=1',

## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',

## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',

## The 'PERMISSION_LOCATION' macro enables the `locationWhenInUse` and `locationAlways` permission. If
## the application only requires `locationWhenInUse`, only specify the `PERMISSION_LOCATION_WHENINUSE`
## macro.
##
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
'PERMISSION_LOCATION_WHENINUSE=0',

## dart: PermissionGroup.notification
#'PERMISSION_NOTIFICATIONS=1',

## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=1',
]

end
end
end
< /code>
info.plist:




CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
Teekit App
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
teekit_app
CFBundlePackageType
APPL
CFBundleShortVersionString
$(FLUTTER_BUILD_NAME)
CFBundleSignature
????
CFBundleVersion
$(FLUTTER_BUILD_NUMBER)
LSRequiresIPhoneOS

UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UISupportedInterfaceOrientations

UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight

UISupportedInterfaceOrientations~ipad

UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight

NSBonjourServices

_http._tcp

CADisableMinimumFrameDurationOnPhone

UIApplicationSupportsIndirectInputEvents

NSAppTransportSecurity

NSAllowsLocalNetworking

NSAllowsArbitraryLoads


NSLocalNetworkUsageDescription
This app needs access to your local network to communicate with the backend server.


< /code>
конечная точка Auth Flutter: < /p>
static const String _baseUrl = 'http://192.168.1.170:8181/api/v1/auth/login';
< /code>
go route сервер: < /p>
v1 := r.Group("/api/v1")

// main.go or routes setup
r.GET("/health", func(c *gin.Context) {
fmt.Println("Hit from:", c.ClientIP())
c.JSON(200, gin.H{"status": "ok"})
})

// Authorization
authGroup := v1.Group("/auth")
{
authGroup.POST("/login", authHandler.Login)
authGroup.POST("/register", authHandler.Register)
}
< /code>
go Server Setup: < /p>
if err := r.Run("0.0.0.0:8181"); err != nil {
logger.Log.Fatalf("Failed to run server: %v", err)
}


Подробнее здесь: https://stackoverflow.com/questions/797 ... cal-server
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «IOS»