dillidon/alerts-and-pickers

is it available in iPad ?

nattaaek opened this issue · 0 comments

i got this error

2018-08-07 15:13:45.663030+0700 playsound[20334:1138125] Error loading /Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio:  dlopen(/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio, 262): no suitable image found.  Did find:
	/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio: mach-o, but not built for iOS simulator
2018-08-07 15:13:45.663232+0700 playsound[20334:1138125] Cannot find function pointer NewDigiCoreAudioPlugIn for factory <CFUUID 0x600000239c00> B8A063B5-2F3D-444A-88CB-D0B8F1B22042 in CFBundle/CFPlugIn 0x7fd33ff071e0 </Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin> (bundle, not loaded)
2018-08-07 15:13:46.157918+0700 playsound[20334:1138125] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x7fd34400b200>) of style UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem.  If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000106f731e6 __exceptionPreprocess + 294
	1   libobjc.A.dylib                     0x0000000102db8031 objc_exception_throw + 48
	2   UIKit                               0x0000000104779043 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3168
	3   UIKit                               0x0000000103c0c4f4 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2537
	4   UIKit                               0x0000000103c09c69 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 436
	5   UIKit                               0x0000000103aa04b3 _runAfterCACommitDeferredBlocks + 318
	6   UIKit                               0x0000000103a8f71e _cleanUpAfterCAFlushAndRunDeferredBlocks + 388
	7   UIKit                               0x0000000103abdea5 _afterCACommitHandler + 137
	8   CoreFoundation                      0x0000000106f15607 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	9   CoreFoundation                      0x0000000106f1555e __CFRunLoopDoObservers + 430
	10  CoreFoundation                      0x0000000106ef9b81 __CFRunLoopRun + 1537
	11  CoreFoundation                      0x0000000106ef930b CFRunLoopRunSpecific + 635
	12  GraphicsServices                    0x000000010c07aa73 GSEventRunModal + 62
	13  UIKit                               0x0000000103a95057 UIApplicationMain + 159
	14  playsound                           0x00000001020680d7 main + 55
	15  libdyld.dylib                       0x0000000109ad1955 start + 1
	16  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 


my code in swift

//
//  Chapter1_25.swift
//  playsound
//
//  Created by student on 8/7/18.
//  Copyright © 2018 harvestidea. All rights reserved.
//

import UIKit
import AVFoundation
import RLBAlertsPickers

class Chapter1_25: UIViewController, AVAudioPlayerDelegate {

    var conversationSound: AVAudioPlayer = AVAudioPlayer()
    var currentColor = UIColor.black
    
    var color = UIColor.black
    
    func audioPlay() {
        
        let path = Bundle.main.path(forResource: "p4highnote.mp3", ofType: nil)!
        let url = URL(fileURLWithPath: path)
        do {
            conversationSound = try AVAudioPlayer(contentsOf: url)
            conversationSound.delegate = self
            conversationSound.play()
        } catch {
            print(error)
        }
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        audioPlay()
        
        let alert = UIAlertController(style: .actionSheet, message: "Select Country")
        alert.addLocalePicker(type: .country) { info in
            // action with selected object
        }
        alert.addAction(title: "OK", style: .cancel)
        alert.show()
        
    }
}