import Firebase
import FirebaseInstanceID
import FirebaseMessaging
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
registerForPushNotifications(application)
FIRApp.configure()
// Add observer for InstanceID token refresh callback.
NSNotificationCenter
.defaultCenter()
.addObserver(self, selector: #selector(AppDelegate.tokenRefreshNotificaiton),
name: kFIRInstanceIDTokenRefreshNotification, object: nil)
// Override point for customization after application launch.
return true
}
func registerForPushNotifications(application: UIApplication) {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
print("===== didReceiveRemoteNotification ===== …Run Code Online (Sandbox Code Playgroud) ios firebase google-cloud-messaging firebase-cloud-messaging firebase-notifications
我正在考虑在数据库中保留所有注册ID(推送令牌)并从iPhone发送通知给用户.我试过这样的事情,但没有得到任何通知.
func sendPNMessage() {
FIRMessaging.messaging().sendMessage(
["body": "hey"],
to: TOKEN_ID,
withMessageID: "1",
timeToLive: 108)
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么或者根本不可能做到这一点?
ios firebase google-cloud-messaging firebase-cloud-messaging firebase-notifications
在iPhone 6 plus上使用ARWorldTrackingSessionConfiguration获取和错误
Unable to run the session, configuration is not supported on this device
它能是什么?
我正在使用ARKit功能,最近的主要iOS版本,但我遇到了错误的崩溃failed assertion
设备不支持MTLRenderPassDescriptor:深度附件的MTLStoreActionMultisampleResolve存储操作
我已经在我的iPhone设备上安装了iOS11测试版.
我正在尝试使用VNImageRequestHandler(iOS Vision)通过相机检测人脸。当我在横向模式下通过相机指向照片时,它会检测到面部,但使用相反的方向模式。
let detectFaceRequestHandler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, options: [:])
Run Code Online (Sandbox Code Playgroud)
有来自的问题VNClassificationObservation.
我的目标是识别对象并使用对象名称显示弹出窗口,我能够获得名称,但我无法获得对象坐标或框架.
这是代码:
let handler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer, options: requestOptions)
do {
try handler.perform([classificationRequest, detectFaceRequest])
} catch {
print(error)
}
Run Code Online (Sandbox Code Playgroud)
然后我处理
func handleClassification(request: VNRequest, error: Error?) {
guard let observations = request.results as? [VNClassificationObservation] else {
fatalError("unexpected result type from VNCoreMLRequest")
}
// Filter observation
let filteredOservations = observations[0...10].filter({ $0.confidence > 0.1 })
// Update UI
DispatchQueue.main.async { [weak self] in
for observation in filteredOservations {
print("observation: ",observation.identifier)
//HERE: I need to display popup with observation name
} …Run Code Online (Sandbox Code Playgroud) 更新到新的Google+ sdk后收到错误NSBundle(GPP3PAdditions)gpp_registerFonts] _block_invoke()无法加载字体:Roboto-Regular
如果有人得到了相同的?谢谢
Safari 12.1是否支持服务人员PWA推送通知?我在iOS上尝试了此演示,但仍然对我不起作用。
有机会得到他们吗?谢谢。
safari push-notification service-worker progressive-web-apps
我可以问一下hepl吗?尝试从 .responseJSON 获取结果但收到响应失败。
func performRequest(_ method: HTTPMethod, requestURL: String, params: [String: AnyObject], comletion: @escaping (_ json: AnyObject?) -> Void) {
Alamofire.request(requestURL, method: .get, parameters: params, encoding: JSONEncoding.default)
.responseJSON { response in
print(response)
if let status = response.response?.statusCode {
switch(status){
case 201:
print("example success")
default:
print("error with response status: \(status)")
}
}
print("data:", response.data ?? "no data")
print("result:", response.result)
if let result = response.result.value {
let JSON = result as! NSDictionary
print("JSON:",JSON)
comletion(JSON)
}
comletion(nil)
}
}
Run Code Online (Sandbox Code Playgroud)
我的回答是:
data: 66809 bytes …Run Code Online (Sandbox Code Playgroud)