Post

Replies

Boosts

Views

Activity

Remote Notification not arriving
Hi I have an issue with Remote notification I use this PHP code to send notification function sendNotification($token, $messageText,$sound) { $tHost = 'gateway.sandbox.push.apple.com'; $tPort = 2195; // Provide the Certificate and Key Data. $tCert = 'cert/pushcert.pem'; // Provide the Private Key Passphrase (alternatively you can keep this secrete // and enter the key manually on the terminal -> remove relevant line from code). // Replace XXXXX with your Passphrase $tPassphrase = 'XXXXX'; // Provide the Device Identifier (Ensure that the Identifier does not have spaces in it). // Replace this token with the token of the iOS device that is to receive the notification. $tToken = $token; // The message that is to appear on the dialog. $tAlert = 'You have a LiveCode APNS Message'; // The Badge Number for the Application Icon (integer >=0). $tBadge = 8; // Audible Notification Option. // The content that is returned by the LiveCode "pushNotificationReceived" message. $tPayload = $messageText; // Create the message content that is to be sent to the device. $tBody['aps'] = array ( 'alert' => $tAlert, 'badge' => $tBadge, 'sound' => $sound, ); $tBody ['payload'] = $tPayload; // Encode the body to JSON. $tBody = json_encode ($tBody); // Create the Socket Stream. $tContext = stream_context_create (); stream_context_set_option ($tContext, 'ssl', 'local_cert', $tCert); // Remove this line if you would like to enter the Private Key Passphrase manually. stream_context_set_option ($tContext, 'ssl', 'passphrase', $tPassphrase); // Open the Connection to the APNS Server. $tSocket = stream_socket_client ('ssl://'.$tHost.':'.$tPort, $error, $errstr, 30, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $tContext); // Check if we were able to open a socket. if (!$tSocket) exit ("APNS Connection Failed: $error $errstr" . PHP_EOL); // Build the Binary Notification. $tMsg = chr (0) . chr (0) . chr (32) . pack ('H*', $tToken) . pack ('n', strlen ($tBody)) . $tBody; // Send the Notification to the Server. $tResult = fwrite ($tSocket, $tMsg, strlen ($tMsg)); if ($tResult) echo 'Delivered Message to APNS' . PHP_EOL; else echo 'Could not Deliver Message to APNS' . PHP_EOL; // Close the Connection to the Server. fclose ($tSocket); } When I execute this it returns "Delivered Message to APNS" but if I put a breakpoint inside func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) { } no notification arrives. All processes of "registerForPushNotifications" are correct. The strange thing is that everything worked until a month ago. This make me crazy. Please help me
2
0
2.3k
Jul ’21
Watchkit problem with Table with big number of rows
Hi. I have a problem when I create a table with WatchKit. If my table has 300 rows works correctly but if I have a table with 1000 rows when I scroll I see lags. How can I solve this? I use swift language This is an example    @IBOutlet weak var myTable: WKInterfaceTable!       override func awake(withContext context: Any?) {     super.awake(withContext: context)       self.myTable.setNumberOfRows(1000, withRowType: "Row")     myTable.curvesAtTop = true     myTable.curvesAtBottom = true         }
0
0
654
Apr ’21
UserDefaults.standard return error EXCBADACCESS (code=1, address=0x38)
Hi I'm using this code to save into UserDefault some datas import UIKit //GLOBAL STRUCT USER struct User: Codable{   var info: UserInfo? } //MARK:-USER INFO struct UserInfo: Codable{   var companyName: String?   var companyAddress: String?   var companyCity: String?   var companyCap: String?   var companyTelephone: String?   var companyFax: String?   var companyMobile: String?   var companyWeb: String?   var companyEmail: String?   var companyVat: String?   var companySDI: String?   var companyPEC: String?   var companyLogo: String?     } struct LocalData{   static var userDatas: User?{     get{       guard let datas = UserDefaults.standard.data(forKey: #function) else {         return User(info: UserInfo(companyName: "", companyAddress: "", companyCity: "", companyCap: "", companyTelephone: "", companyFax: "", companyMobile: "", companyWeb: "", companyEmail: "", companyVat: "", companySDI: "", companyPEC: "", companyLogo: ""))                 }       do{         let myData = try JSONDecoder().decode(User.self, from: datas)         return myData       }       catch{         print(error)       }       return User(info: UserInfo(companyName: "", companyAddress: "", companyCity: "", companyCap: "", companyTelephone: "", companyFax: "", companyMobile: "", companyWeb: "", companyEmail: "", companyVat: "", companySDI: "", companyPEC: "", companyLogo: ""))     }     set{       guard let mydatas = try? JSONEncoder().encode(newValue) else { return }       print(mydatas)       UserDefaults.standard.setValue(mydatas, forKey: #function)             }   } } LocalData.userDatas?.info?.companyAddress = "TEST" print(LocalData.userDatas?.info) If I try to run this code into PlayGround I get this error error: Execution was interrupted, reason: EXCBADACCESS (code=1, address=0x38). The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation. How can I solve this?
2
0
913
Jan ’21
The filter 'CIPortraitEffectSpillCorrection' is not implemented in the bundle
Hi, I use this function to generate a QRCode Image func generateQRCode(string: String, height: CGFloat, width: CGFloat)->UIImage?{   let data = string.data(using: String.Encoding.ascii)       if let filter = CIFilter(name: "CIQRCodeGenerator") {     filter.setValue(data, forKey: "inputMessage")     filter.setValue("Q", forKey: "inputCorrectionLevel")     let transform = CGAffineTransform(scaleX: 3, y: 3)           if let output = filter.outputImage?.transformed(by: transform) {       let scaleX = width / output.extent.size.width       let scaleY = height / output.extent.size.height               let transformedImage = output.transformed(by: CGAffineTransform(scaleX: scaleX, y: scaleY))               return UIImage(ciImage: transformedImage)     }   }   return UIImage() } In another app works correctly but in the app that I develop I get this error. The filter 'CIPortraitEffectSpillCorrection' is not implemented in the bundle at /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/CoreImage/PortraitFilters.cifilter How can I solve this?
4
0
4k
Jan ’21