Post

Replies

Boosts

Views

Activity

Cannot get Xcode archive Distribution to install on iOS Device
When I airdrop my archived app to my device it runs perfectly. But when I try to share with colleagues using the manifest.plist in a website link, the app will not install (Even on the same device where the airdropped app did). I get "Unable to Install [app name]" Any help with this will be appreciated. Here is my manifest.plist: `<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>items</key> <array> <dict> <key>assets</key> <array> <dict> <key>kind</key> <string>software-package</string> <key>url</key> <string>https://www.scorcent.com</string> </dict> <dict> <key>kind</key> <string>display-image</string> <key>url</key> <string>https://www.scorcent.com/image_57x56.png</string> </dict> <dict> <key>kind</key> <string>full-size-image</string> <key>url</key> <string>https://www.scorcent.com/image_512x512.png</string> </dict> </array> <key>metadata</key> <dict> <key>bundle-identifier</key> <string>ScorCent</string> <key>bundle-version</key> <string>6.0</string> <key>kind</key> <string>software</string> <key>platform-identifier</key> <string>com.apple.platform.iphoneos</string> <key>title</key> <string>NO REGRETS</string> </dict> </dict> </array> </dict> </plist> `And here is my web url; <a href=itms-services://?action=download-manifest&url=https://www.scorcent.com/manifest.plist" Install App
0
0
98
3w
Automatically dismiss AV Player
Hello: I am trying to have my AVPlayer to automatically dismiss when Video completes. The code is giving me some problems with errors. Here is the code and errors. Hope some one can point me to a way to correct the errors:     @IBOutlet weak var playerView: AVPlayerView!      override func viewDidLoad() {          super.viewDidLoad()          guard let path = Bundle.main.path(forResource: "chosePrize", ofType:"mp4") else {               debugPrint("Not found")               return          }              let playerURL = AVPlayer(url: URL(fileURLWithPath: path))&#9;                playerView.player = playerURL         NotificationCenter.defaultCenter.addObserver(self, selector: Selector(("playerDidFinishPlaying:")),         name: NSNotification.Name(name: AVPlayerDidPlayToEndTime, object: nil), //Use of unresolved identifier 'AVPlayerDidPlayToEndTime'         playerView.player?.play()     func donePlaying(notification:NSNotification) // Expected ')' in expression list {             print("video ended")            }          // Do view setup here.     } }
0
0
506
Nov ’20
AVPlayer doesn't work in app
Hello: I am adding a video file to my MAC application. Before I create an archive, the video plays perfectly but when I run a copy of the archive, when I click on the button to start the video, NOTHING HAPPENS. No error message, Nothing. Any help to resolve this issue will be appreciated. Here is the code: This code: @IBAction func AVSegue(_ sender: Any) { let mainStoryboard = NSStoryboard(name: "Main", bundle: Bundle.main) guard let avPlayerViewController = mainStoryboard.instantiateController (withIdentifier: "AVID") as? AVPlayerViewController else { print("Couldn't find viewController" )         return         } presentAsModalWindow(avPlayerViewController)   } triggers the ViewController with the AV Player: import Cocoa import AVKit import AVFoundation class AVPlayerViewController: NSViewController {     @IBOutlet weak var playerView: AVPlayerView!         override func viewDidLoad() { super.viewDidLoad()             let url = URL(fileURLWithPath: Bundle.main.path(forResource:"SMRIntro",ofType: "mp4")!)             let player = AVPlayer(url: url)             playerView.player = player             player.play()           } }
4
0
3.8k
Jul ’20
Container View IDSegue binding error
My Mac OS app was running fine until today when my TabView Controller ceased to load images for the pop-up (xy) button to display. When I checked the connection there was this error message: Container View does not have a IBSegueTriggerViewDidLoad binding. Below the Triggered Segues is ViewDidLoad and Below the Connection tab is Tab View Controller: Embed with the yellow caution icon. By hovering over the icon I see the above error. What can I do to reconnect this binding? I deleted the connection and redo the segue but the error comes back. Any help will be appreciated.
1
1
602
Jun ’20
How to start an animation without button Tap
Hello:I've read just about every thing I could find about animations in my MAC OSx app. However, I've not been able to find a useful tutorial of example. Nearly All the examples i found are for iOS and all of those animations are initiated by tapping a button.I want to be able to make the image on my main window Zoom in from a small icon to fill the window in a gradual zoom in motion as the app main View is loaded.I will appreciate any example, tutorial, or Swift resource that could be useful in solving this problem.Thanks in Advance.
17
0
4.7k
Jun ’20
How to save plist data to CoreData
Hello:I have successfully read data from a plist and want to save that data to CoreData. From the code below I am not getting errors but it is not saving the plist data.Please suggest what I am missing:func preloadScq() { print("Call to preload Data Starts Now") let preloadedDataKey = "didPreloadData" UserDefaults.standard.removeObject(forKey: preloadedDataKey) let userDefaults = UserDefaults.standard if userDefaults.bool(forKey: preloadedDataKey) == false { guard let plistUrl = Bundle.main.url(forResource: "SCQ", withExtension:"plist") else { return } let backgroundContext = persistentContainer.newBackgroundContext() persistentContainer.viewContext.automaticallyMergesChangesFromParent = true backgroundContext.perform { let scqObjects = NSEntityDescription.insertNewObject(forEntityName: "SCQ", into: backgroundContext) if let arrayContents = NSArray(contentsOf: plistUrl) as? [String] { do { let plistData = try Data(contentsOf: plistUrl) let scqList = try PropertyListDecoder().decode([Scq].self, from: plistData) for scqName in scqList { let scqObject = SCQ(context: backgroundContext) scqObject.answer = "answer" // the first object in the plist print ("Answer is \(scqObject)") // This doesn't print anything } try backgroundContext.save() } catch { print(error) print ("Your Record is Saved") } } } //
4
0
2.6k
May ’20
Value of Type Bool has no subscripts. What does it mean in context?
Hello:I am getting the error Value of Type Bool has no subscripts in bellow code but can't figure out how to resolve it. Any help will be appreciated.The error is on line # 19. That line is supposed to call first record and continue with subsequest records in the plist.func preloadData() { print ("Call to preload Data Starts Now") let preloadedDataKey = "didPreloadData" UserDefaults.standard.removeObject(forKey: preloadedDataKey) let userDefaults = UserDefaults.standard if userDefaults.bool(forKey: preloadedDataKey) == false { guard Bundle.main.url(forResource: "SCQ", withExtension:"plist") != nil else { return } var propertyListFormat = PropertyListSerialization.PropertyListFormat.xml //format the property list var plistData: [String: AnyObject] = [:] // the data print(plistData) let plistUrl = Bundle.main.url (forResource: "SCQ", withExtension: "plist") // path of the data let fileManager = FileManager.default if let plistData = NSData(contentsOf: plistUrl!) { var format = PropertyListSerialization.PropertyListFormat.xml do { let items = PropertyListSerialization.propertyList(plistData, isValidFor: format) let item = items[0]// error here if let attribute = item ["answer"] { print (item) } if let attribute = item ["distractor1"] { print (item) } if let attribute = item ["distractor2"] { print (item) } if let attribute = item ["distractor3"] { print (item) } if let attribute = item ["distractor4"] { print (item) } if let attribute = item ["distractor5"] { print (item) } if let attribute = item ["grade"] { print (item) } if let attribute = item ["id"] { print (item) } if let attribute = item ["answer"] { print (item) } if let attribute = item ["qid"] { print (item) } if let attribute = item ["question"] { print (item) } if let attribute = item ["qValue"] { print (item) } if let attribute = item ["skill"] { print (item) } if let attribute = item ["subject"] { print (item) } if let attribute = item ["topic"] { print (item) } } catch { print(error) } }
7
0
2.4k
May ’20
How to keep variables available to cross check when used later
Hello:I want to be able to check if a specific Core Data record was fetched previously by comparing the Record ID with the one being currently fetched. I want to some how to mark each fetched record so I can know whether or not it has been called before.I don't want to save every fetched record to a data store then compare new fetches with what is there because it would call for a lot of processing resources.Is there an easier way?Thanks.
6
0
891
May ’20
How to capture textfield input from NSTextField
Hello:I want to capture the input value in a text field into a variable. Here is my code:var window: NSWindow? func checkGroupName() { let alert = NSAlert() alert.messageText = "Please enter your group name" alert.addButton(withTitle: "Save") alert.addButton(withTitle: "Cancel") let inputTextField = NSTextField(frame: NSRect(x: 0, y: 0, width: 300, height: 24)) inputTextField.placeholderString = ("Enter your group name") alert.accessoryView = inputTextField alert.runModal() let object = NSTextField() let value = object.stringValue print("The value of Group Name is \(value)") }What should I add to the above code to get the value entered in a variable i can use later in the code? "value" above is empty.
2
0
1.9k
May ’20
Alert produces app crash
Hello:I am trying to get my users to provide some information to use in the app by present an alert as the user begins. My code is causing a crash with fatal error Unexpectedly found nil while unwrapping an Optional value (line 13). var window: NSWindow? func checkGroupName() { let alert = NSAlert() alert.messageText = "Please enter your group name" alert.addButton(withTitle: "Save") alert.addButton(withTitle: "Cancel") let inputTextField = NSTextField(frame: NSRect(x: 0, y: 0, width: 300, height: 24)) inputTextField.placeholderString = "Enter group name" alert.accessoryView = inputTextField alert.beginSheetModal(for: self.view.window!, completionHandler: { (modalResponse) -&gt; Void in if modalResponse == NSApplication.ModalResponse.alertFirstButtonReturn { let enteredString = inputTextField.stringValue print("Entered string = \"\(enteredString)\"") } }) }What is causing the error?
2
0
1k
May ’20
Why fatal error with call awakeFromNib?
Hello:I have this code and getting error:Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional valueWhat can I do to prevent the error? Here is the code:class ViewController: NSViewController,NSWindowDelegate { var window: NSWindow! override func viewDidLoad() { super.viewDidLoad() } func windowShouldClose(sender: AnyObject) -&gt; Bool { NSApp.hide(nil) return false } override func awakeFromNib() { super.awakeFromNib() view.window!.delegate! = self //Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value }Thanks for help.
7
0
1.3k
Mar ’20
Call to open Storyboard ViewController cashes app
Hello:I am trying to open a Storyboard View from an @IBAction but the app crashes with no log output. Any help will be appreciated.Below is the code. Lines 10 to 18 are highlighted in the code when the crash occurs.@IBActionfunc launchMainMenu(_ sender: NSMenuItem) { if ((mainWindowController) == nil){ var windowController : NSWindowController? let storyboard = NSStoryboard() func openMyWindow() { if let vc = storyboard.instantiateController(withIdentifier: "4554") as? ViewController { let myWindow = NSWindow(contentViewController: vc) myWindow.makeKeyAndOrderFront(self) let controller = NSWindowController(window: myWindow) controller.showWindow(self) } } openMyWindow() } }
1
0
583
Mar ’20
Can't reopen app from menu after closed
Hello:Since the beginning of March, I have been trying to respond to a demand by Apple without success:The requirement is that when a user closes the main window of my app by clicking on the red x, I must they must be able to relaunch the main window from a menu.I have been able to hide the window and relaunch it beu am unable to relaunch the window when the red x is clicked, EVEN THOUGH THE APP ICON IS STILL ON THE DOCK.I hope someone can point me in the right direction. Here is my code: (I'm sure I have stuff here I don't need. Would appreciate to know which lines to cut.import Cocoa import ServiceManagement @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { @IBOutlet weak var showMainMenu: NSMenu! var window: NSWindow! var statusBarItem: NSStatusItem? func applicationDidFinishLaunching(_ aNotification: Notification) { window = NSApplication.shared.windows[0] let statusBar = NSStatusBar.system statusBarItem = statusBar.statusItem( withLength: NSStatusItem.squareLength) let itemImage = NSImage(named: "SMR_icon") itemImage?.isTemplate = true statusBarItem?.button?.image = itemImage statusBarItem?.button?.action = #selector(self.statusBarButtonClicked(sender:)) statusBarItem?.button?.sendAction(on: [.leftMouseUp, .rightMouseUp]) // &lt;&lt; send action in both cases let statusBarMenu = NSMenu(title: "Status Bar Menu") statusBarMenu.addItem( withTitle: "Launch ScorCent Master Review", action: #selector(AppDelegate.LaunchScorCentMasterReview), keyEquivalent: "") statusBarMenu.addItem( withTitle: "Quit ScorCent Master Review", action: #selector(AppDelegate.QuitScorCentMasterReview), keyEquivalent: "") statusBarMenu.addItem( withTitle: "Terminate ScorCent Master Review", action: #selector(AppDelegate.StopScorCentMasterReviewApplication), keyEquivalent: "") // Setting menu statusBarItem?.button?.menu = statusBarMenu // &lt;&lt; store menu in button, not item } @IBAction func LaunchWindowMain(_ sender: NSMenuItem) { func applicationShouldHandleReopen(theApplication: NSApplication, hasVisibleWindows flag: Bool) -&gt; Bool { if !flag{ window.makeKeyAndOrderFront(nil) for window: AnyObject in theApplication.windows { window.makeKeyAndOrderFront(self) } } return true } } @objc func statusBarButtonClicked(sender: NSStatusBarButton) { let event = NSApp.currentEvent! if event.type == NSEvent.EventType.leftMouseUp { print("Left click!") if let button = statusBarItem?.button { // &lt;&lt; pop up menu programmatically button.menu?.popUp(positioning: nil, at: CGPoint(x: -1, y: button.bounds.maxY + 5), in: button) } } else { print("Left click!") } } @objc func QuitScorCentMasterReview(_ sender: Any?) { NSApplication.shared.hide(QuitScorCentMasterReview) print("Close the App") } @objc func LaunchScorCentMasterReview(_ sender: NSStatusBarButton) { NSApplication.shared.unhide(AppDelegate.LaunchScorCentMasterReview) NSApplication.shared.unhide(AppDelegate.init()) print("Launch the App") } @objc func StopScorCentMasterReviewApplication(_sender: Any?) { NSApplication.shared.terminate(AppDelegate.StopScorCentMasterReviewApplication) print("Stop the App") } func applicationWillTerminate(_ aNotification: Notification) { }
14
0
3.4k
Mar ’20