小编Son*_*yen的帖子

GCP API网关:无法使用路径参数

我正在努力将路径参数从网关传递到实际端点。

这是我的 Open API yaml:

swagger: '2.0'
info:
  description: |
    Blah blah
  version: 0.0.1
  title: SSAuth
  contact:
    email: blah@gmail.com
schemes:
  - https
produces:
  - application/json
paths:
  /v0/auth/users/echo:
    get:
      summary: check the health of api
      operationId: healthCheck
      consumes:
        - application/json
      produces:
        - application/json
      responses:
        200:
          description: OK
      x-google-backend:
        address: https://path-to-my-cloud-run-service/v0/auth/users/echo
      security:
        - api_key: []

  /v0/auth/users/type/{type}:
    post:
      summary: Add a new user to the user
      operationId: addUser
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - name: type
          in: path
          description: provider type …
Run Code Online (Sandbox Code Playgroud)

yaml google-cloud-platform openapi google-cloud-api-gateway

6
推荐指数
1
解决办法
2312
查看次数

iOS:AppDelegate 方法未调用 SwiftUI 2

我正在尝试将 FCM 集成到我使用 SwiftUI 2 的项目中。我遇到的问题是 AppDelegate 方法没有被调用。在我的主应用程序结构中,我有这个:

@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
Run Code Online (Sandbox Code Playgroud)

但唯一被调用的方法是func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool.

其余的不起作用。我可以使用视图修饰符获得所有必需的方法,但没有application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data). 所以我无法将 APN 令牌设置为 FCM。我尝试打开和关闭 swizzling(与 didRegisterForRemoteNotificationsWithDeviceToken 没有被调用几乎相同,并且我确实在 swizzling 关闭的情况下设置了令牌)。

AppDelegate 方法未被调用的问题似乎是一个已知问题,因为我看到其他开发人员也有这个问题。

任何建议都非常感激。谢谢

更新: 在尝试了我能想到的所有方法几个小时后,我放弃并返回到纯 AppDelegate 生命周期,并使用显示我的 SwiftUI 视图的持有者视图控制器。

ios swift firebase-cloud-messaging swiftui

5
推荐指数
0
解决办法
494
查看次数

相当于 Dart 中 Swift 的 if let 和 guard let

刚刚开始使用原生 iOS 背景的 Flutter,所以我有一个关于 Dart beta null 安全的快速问题。

所以在 Swift 中,因为他们像 Kotlin 一样从一开始就有空安全的想法,所以我非常喜欢这门语言的两个特性是if letguard let。这两个使使用可选值变得更加容易。我不确定 Dart 的测试版是否有类似的东西。

谢谢

dart flutter dart-null-safety

5
推荐指数
2
解决办法
2213
查看次数

SwiftUI:fullScreenCover 的半透明背景

所以从技术上讲,我想显示一个加载屏幕视图。我正在使用fullScreenCover.

struct ContentView: View {
    
    @State private var isLoading = false
        
    var body: some View {
        VStack {
            Text("Hello there")
            Button("Start loading") {
                isLoading.toggle()
            }
            .fullScreenCover(isPresented: $isLoading) {
                ZStack{
                    Color.black.opacity(0.5).edgesIgnoringSafeArea(.all)
                    VStack {
                        ProgressView()
                        Button("Stop loading") {
                            isLoading.toggle()
                        }
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是我无法使这个加载屏幕半透明。sheetpopover以同样的方式行事。

ios swift swiftui

4
推荐指数
5
解决办法
2048
查看次数

Android模拟器命令行不会终止

我有一个简单的shell脚本(在Mac上运行),如下所示:

/Users/abcdef/Library/Android/sdk/tools/emulator -avd Pixel_API_23
./gradlew assembleDebug assembleAndroidTest
fastlane screengrab
Run Code Online (Sandbox Code Playgroud)

问题是运行第一行之后,它会很好地启动仿真器,但是命令停顿了,它不会完成,因此无法执行下一行。我试图强行停止它,但是那甚至行不通。如果我关闭该终端,启动一个新终端,然后再次运行脚本,则第一个命令将退出(仿真器已在运行),其余命令将被执行。
我想自动截图一系列设备,所以我想使用一个shell脚本。

bash shell android android-emulator

3
推荐指数
1
解决办法
355
查看次数