小编akd*_*uza的帖子

线程警告:['Camera']花了'290.006104'ms.插件应该使用后台线程

我正在Phonegap为IOS 构建一个应用程序.我用Cordova相机plugin进行个人资料图片上传.我的示例代码是:

navigator.camera.getPicture(that.imageDataSuccessCallback, that.imageDataErrorCallback, { quality: 10, destinationType: 1, encodingType: 0, allowEdit: true, correctOrientation: true, sourceType:0 });
Run Code Online (Sandbox Code Playgroud)

当我点击该特定按钮时,我收到警告

THREAD WARNING: ['Camera'] took '290.006104' ms. Plugin should use a background thread.
Run Code Online (Sandbox Code Playgroud)

它阻止了我的应用.任何人都可以建议如何解决这个问题?

camera ios phonegap-plugins cordova cordova-plugins

2
推荐指数
1
解决办法
4156
查看次数

EventKit 权限

EventKit当尝试将事件添加到日历但访问被拒绝时,我希望我请求对日历的许可。它仅在第一次使用应用程序时询问,如果您在设置中拒绝访问,它不会提示用户再次授予访问权限。请帮忙。

额外的功劳:我还希望它检查日历中是否已存在该事件,如果存在,请对其进行编辑。对此的任何帮助也将不胜感激!!

这是我的代码:

func addToCalendar(){
    let eventStore = EKEventStore()

    let startDate = NSDate()
    let endDate = startDate.dateByAddingTimeInterval(60 * 60) // One hour

    if (EKEventStore.authorizationStatusForEntityType(.Event) != EKAuthorizationStatus.Authorized) {
        eventStore.requestAccessToEntityType(.Event, completion: {
            granted, error in
            self.createEvent(eventStore, title: "\(self.meal.text!)", startDate: startDate, endDate: endDate)
        })
    } else {
        createEvent(eventStore, title: "\(self.meal.text!)", startDate: startDate, endDate: endDate)
    }
}

func createEvent(eventStore: EKEventStore, title: String, startDate: NSDate, endDate: NSDate) {
    let event = EKEvent(eventStore: eventStore)

    event.title = title
    event.startDate = startDate
    event.endDate = endDate
    event.calendar = …
Run Code Online (Sandbox Code Playgroud)

ios eventkit swift

2
推荐指数
1
解决办法
1491
查看次数

如何在 spritekit 中向节点添加滑动手势

我正在尝试向节点添加滑动手势,以便当用户滑动它时,它会离开屏幕,但我不断收到SIGABRT错误消息:

`Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[fidget2.PlankScene swipedRight:]: unrecognized selector sent to instance 0x7ff4c3603e00'`
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会弹出这个错误。我确保节点在.sks文件中正确标记。这是我的代码:

import SpriteKit


let plankName = "woodPlank"

class PlankScene: SKScene {

  var plankWood : SKSpriteNode?


  override func didMove(to view: SKView) {

    plankWood = childNode(withName: "woodPlank") as? SKSpriteNode


    let swipeRight : UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: Selector("swipedRight:"))

    swipeRight.direction = .right

    view.addGestureRecognizer(swipeRight)

  }


  func swipedRight(sender: UISwipeGestureRecognizer) {

    print("Object has been swiped")

  }


 func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent)
  {
    let touch …
Run Code Online (Sandbox Code Playgroud)

ios sprite-kit skspritenode skscene swift

2
推荐指数
1
解决办法
2688
查看次数

如果iOS设备上未安装应用程序,则通用链接无效

我已经在我的应用程序和服务器端实现了通用链接.安装应用程序后,一切正常.如果设备上没有安装应用程序,我点击说明或邮件的通用链接,我会被重定向到我可以下载应用程序的应用程序商店.但是,在下载完成时,如果我在应用程序商店页面中单击"打开",则不会调用下面的应用程序委托方法:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler
Run Code Online (Sandbox Code Playgroud)

因此,我无法执行某些操作以响应userActivity.webpageURL应用程序运行或以前安装在设备上时通常会遇到的操作.这是正常的行为吗?即如果未安装该应用,通用链接将仅作为从应用商店安装应用的媒介?

iphone objective-c ios ios-universal-links

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

嵌套滚动视图高度问题

我已经用底表实现了Google地图。但是,当我检查布局时,地图位于屏幕顶部,而不占据屏幕的整个宽度和高度。我已经尝试了多种方法来解决此问题,但是没有运气。

在此处输入图片说明

在此处输入图片说明

下面是布局代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" >

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_gravity="fill_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        >
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="fill_vertical"
           >
            <fragment  xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:map="http://schemas.android.com/apk/res-auto"
                xmlns:tools="http://schemas.android.com/tools"
                android:id="@+id/map"
                android:layout_gravity="fill_vertical"
                android:name="com.google.android.gms.maps.SupportMapFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.app.headcount.MapsActivity"
                />
        </RelativeLayout>
    </android.support.v4.widget.NestedScrollView>


    <include layout="@layout/test"
        android:id="@+id/design_bottom_sheet"/>



</android.support.design.widget.CoordinatorLayout>



</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

您能否看一下这个问题,让我知道问题出在哪里?谢谢。

android android-layout android-fragments google-maps-android-api-2 android-nestedscrollview

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

如何在 SwiftUI 中绘制角度和弧线

我正在尝试画一个相当基本的鸟形状。我使用圆圈作为身体,并尝试绘制上喙(以红色突出显示),如下面的参考图所示。

图片参考:

在此输入图像描述

struct Beak: Shape {
    func path(in rect: CGRect) -> Path {
        var path = Path()
        path.move(to: CGPoint(x: rect.width/4, y: rect.height/2))
        path.addLine(to: CGPoint(x: 0, y: rect.height/2))
        // draw a line back to the circumference at a given angle
        // & close it with an arc along the circumference of the Body circle
        path.addLine(to: ??) 
        return path
    }
}

struct BirdView: View {
    var body: some View {
        ZStack {
            // MARK: Body
            Circle()
                .stroke(lineWidth: 10)
                .frame(width: 150)
                .overlay(alignment: .center) …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui

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