Post not yet marked as solved
I am trying to compile on my iPhone XS device an app on Xcode Version 14.0 beta 2. First time I connected the device it correctly showed among the devices urging me to enable Developer Modality on Privacy & Security. I did it and the iPhone restarted, but once it happened the iPhone disappeared from the targets, thus not allowing me to compile on it. For some strange reason my iPad instead showed, but when I tried to compile on it, Xcode of course urged me to connect it.
So it seems Xcode sees not connected device and does not see connected devices.
Is anyone able to give a sense to that and possibly a solution?
Post not yet marked as solved
While showing arifacts my app crashes abruptedly on:com.apple.scenekit.scnview-renderer (21): EXC_BAD_ACCESS (code=1, address=0xed0a7ac80)while I run it from Xcode.No crash is instead produced when running the app by itself.I tried not inserting or deleting nodes while Scenekit was rendering by means of a lock, but that changed nothing.I also submitted a ticket to Apple.Anyone else experiences it and has some solution?
Post not yet marked as solved
Hullo,
I would like to send safari notification when the rss file on my website changes. There are several commercial service that grant it for a quite high monthly feed I may not afford for a non-commercial web site. Is there some tutorial about how to handle the thing both on the back-office and from office, in some way Apple presents a tutorial for the front office, but nothing for the back-office to communicate with it. May someone point me to a solution or a tutorial?
Post not yet marked as solved
I am trying to implement web notifications for Safari with the following code in the client:
script
var pushId = "pushId";
var pushNotification = function () {
if ('safari' in window && 'pushNotification' in window.safari) {
var permissionData = window.safari.pushNotification.permission(pushId);
checkRemotePermission(permissionData);
} else {
alert("Push notifications not supported.");
}
};
var checkRemotePermission = function (permissionData) {
console.log("Chiamo checkRemotePermission");
if (permissionData.permission === 'default') {
window.safari.pushNotification.requestPermission(
'socket url'
pushId,
{},
checkRemotePermission
);
console.log("Requested");
} else if (permissionData.permission === 'denied') {
console.log("denied");
alert("denied");
} else if (permissionData.permission === 'granted') {
console.log("The user said yes, with token: "+ permissionData.deviceToken);
alert(permissionData.deviceToken)
}
};
/script
button name="subscribe" value="Activate Notifications" onclick="pushNotification()"Activate Notifications/button
And on the server side distributed by node.js:
var express = require('express');
var app = express();
var port = process.env.PORT || 3000;
console.log('entering on port: '+port)
app.listen(port);
app.get('/', function(req, res) {
console.log('get');
res.sendfile('index.html');
});
app.post('/v2/pushPackages/web.net.inarrivo.pizzomarinellafs', function(req, res) {
console.log('register');
res.sendfile('pushPackage.zip');
});
app.post(''socket url'/v2/devices/deviceToken/registation/pushId, function(req, res) {
console.log(res)
});
app.post(''socket url'/v2/log', function(req, res) {
console.log(res)
});
Yet I always receive 'denied' and it even seems the back office script is not even touched given no console log is written after the first one. The port on which it is listening is 3000, but I have no idea how to set it on the client side. What is strange is that if I change the url in:
window.safari.pushNotification.requestPermission(
'url2'
pushId,
{},
checkRemotePermission
);
to a dummy server I get the same denied answer, like the server were never connected anyway. May someone help to have this thing working?
Post not yet marked as solved
Quite abrupdedly my project stopped executing by reporting error:error: WatchKit App doesn't contain any WatchKit Extensions. Verify that the value of NSExtensionPointIdentifier in your WatchKit Extension's Info.plist is set to com.apple.watchkit.Of course NSExtensionPointIdentifier is correctly set to com.apple.watchkit.What could it be and how to fix it?This is the relevant part of the info.plist file:<key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>WKAppBundleIdentifier</key> <string>com.information.inArrivo.watchkitapp</string> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.watchkit</string> </dict>
Post not yet marked as solved
When I compile my code on Xcode Version 8.0 beta 4 (8S188o) I get this single error bringing the compilation to failure:Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1I tried to clean the derived folder but that did not change things. What is it and how may I know more about it?The only peculiar thing is that all the objective-c files I have removed after porting them to Swift are reported as missing:file:///Users/fbartolom/Documents/cocoa%20applications/inArrivoHD/teleportDetail.h: warning: Missing file: /Users/fbartolom/Documents/cocoa applications/inArrivoHD/teleportDetail.h is missing from working copyI checked them in the project and they are not there, I tried even to commit, but that did not change the thing.
Post not yet marked as solved
This week I received twice a negative balance for the purchase of my app Jam Session, so losing each time 50% of the price including VAT and the Apple share going negative two times. I wonder if there is some way to check people do not intentionally purchase and ask the refund of a given app just for the purpose of damaging the developer! The issue is quite strange given it has very rarely happened to other apps of mine and twice for a single app in a week.I have decreased the price of the app on the point of bayonet so to lose less money if this thing repeats but I do not see see any other way than stop the purchase of the app as it actally costs me each time it is downloaded!In particular how do I know the nationality of the refunds and if they belong to the same delinquent user?
Post not yet marked as solved
Hullo, I need to encode and decode a simple enum with no associated values, but I only find examples with associated values and someone say a bare enum would be automatically Codable, what the compiler does not agree upon. This is my code sale that looks very clumsy, though:
enum MeditationItem: Codable, CodingKey{
case morning
case evening
case dropIn
case dropOut
case intermediate
case single
case supported
case walking
func nameForKind()->String{
		switch self{
		case .morning: return "Morning"
		case .evening: return "Evening"
		case .dropIn: return "dropIn"
		case .dropOut: return "dropOut"
		case .intermediate: return "intermediate"
		case .single: return "Single"
		case .supported: return "Supported"
		case .walking: return "Walking"
		}
}
init(from decoder: Decoder) throws {
		do {
				let container = try decoder.container(keyedBy: MeditationItem.self)
				do {
						let morning = try container.decode(MeditationItem.self, forKey: .morning)
						self=morning
				} catch {
						let evening = try container.decode(MeditationItem.self, forKey: .evening)
						self=evening
				}
		
}
What is the most sleek way to encode and decode an enum with no associated values?
Post not yet marked as solved
I am trying to add a graphic button in the navigation bar of an UIIMagePickerController with little luck. This is my class in which I tried to set it nearly everywhere with no success:import UIKit
class PickerViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate{
var pickImageCallback : ((UIImage?) -> ())?
var cancelImageCallback : (() -> Void)?
var cameraView: UIView!
var cameraButton:UIButton!
var picker = UIImagePickerController()
override func viewDidLoad() {
super.viewDidLoad()
picker.delegate=self
picker.sourceType = .photoLibrary
picker.navigationBar.isTranslucent = false
picker.navigationBar.barTintColor = .blue // Background color
picker.navigationBar.tintColor = .white // Cancel button ~ any UITabBarButton items
picker.navigationBar.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.white
]
self.present(picker, animated: true, completion: nil)
//self.add(asChildViewController: picker)
}
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
print("m in")
self.navigationItem.leftBarButtonItem=UIBarButtonItem(image: UIImage(named:"camera"), style: .plain, target: self, action: #selector(openCamera))
navigationController.navigationBar.tintColor=UIColor.black
navigationController.navigationBar.barTintColor=UIColor.red
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationItem.rightBarButtonItem=UIBarButtonItem(image: UIImage(named:"camera"), style: .plain, target: self, action: #selector(openCamera))
//self.cameraView=UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 40))
//self.cameraView.backgroundColor=UIColor.clear
//cameraButton=UIButton(frame: CGRect(x: 60, y: 12, width: 50, height: 35))
//cameraButton.setBackgroundImage(UIImage(named:"camera"), for: .normal)
//cameraButton.reversesTitleShadowWhenHighlighted=true
//cameraButton.addTarget(self, action: #selector(openCamera), for: .touchUpInside)
//self.cameraView.addSubview(cameraButton)
//self.view.addSubview(cameraView)
}
private func add(asChildViewController viewController: UIViewController) {
// Add Child View Controller
addChild(viewController)
// Add Child View as Subview
view.addSubview(viewController.view)
// Configure Child View
viewController.view.frame = view.bounds
viewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
// Notify Child View Controller
viewController.didMove(toParent: self)
viewController.navigationItem.leftBarButtonItem=UIBarButtonItem(image: UIImage(named:"camera"), style: .plain, target: self, action: #selector(openCamera))
}
@objc func openCamera(picker: UIImagePickerController){
if(UIImagePickerController.isSourceTypeAvailable(.camera)){
let picker=UIImagePickerController()
picker.delegate=self
picker.sourceType = .camera
picker.showsCameraControls=true
self.add(asChildViewController: picker)
} else {
let title=NSLocalizedString("Warning", comment:"")
let message=NSLocalizedString("You don't have camera", comment:"")
let dismiss=NSLocalizedString("Dismiss", comment:"")
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
let cancelAction = UIAlertAction(title: dismiss, style: .cancel) { (action) in
}
alertController.addAction(cancelAction)
if let viewController=UIApplication.topViewController() as? ViewController{
viewController.proxyPresentViewController(alertController, animated: true, completion: nil)
}
}
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
cancelImageCallback?()
picker.dismiss(animated: true, completion: nil)
self.dismiss(animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
self.dismiss(animated: true, completion: nil)
var finalImage: UIImage?
if let image = info[.livePhoto] as? UIImage {
finalImage=image
} else if let image = info[.editedImage] as? UIImage {
finalImage=image
} else if let image = info[.originalImage] as? UIImage {
finalImage=image
}
picker.dismiss(animated: true, completion: nil)
dismiss(animated: true, completion: nil)
pickImageCallback?(finalImage)
}
}
}
picker.dismiss(animated: true, completion: nil)
dismiss(animated: true, completion: nil)
pickImageCallback?(finalImage)
}
}
Post not yet marked as solved
I got:[Session] Session (0x10495f5b0): did fail with error: Error Domain=com.apple.arkit.error Code=102And so I tried to intercepts and handle it with
class SceneLocationViewDelegate: ARSCNVDelegate{
func session(_ session: ARSession, didFailWithError error: Error) {
// Present an error message to the user
print("Session failed. Changing worldAlignment property.")
print(error.localizedDescription)
if let arError = error as? ARError {
switch arError.errorCode {
case 102:
configuration.worldAlignment = .gravity
restartSessionWithoutDelete()
default:
restartSessionWithoutDelete()
}
}
}
}But I get several errors on most keywords: what is wrong and how do I hande that error anyway?