草庐IT

Swift-Mailer

全部标签

swift - Alamofire http post - 注册用户 Swift 3

小问题:我正在使用Alamofire库将用户注册到我的数据库。我从后端开发人员那里获得了端点和参数,并亲自在Postman中对其进行了测试,数据正常通过。我在我的RegisterViewController中实现它,但没有得到任何响应。这是我的实现。仅供引用:我离开了ViewController的用户类型。最终用户不应该知道他们是用户类型3。我可能在这里做错了什么。我没有在输出中得到任何响应。letparams=["username":usernameField.text!,"firstname":firstNameField.text!,"lastname":lastNameFiel

ios - Swift ios 检查用户是否启用了通知总是返回 true

这个问题在这里已经有了答案:CheckingPushNotificationRegistration:isRegisteredForRemoteNotificationsNotUpdating(2个答案)关闭6年前。我正在尝试检查用户是否为我的应用启用了远程通知,但即使我禁用/卸载了我的应用,它也始终返回true。我正在检查这段代码:ifUIApplication.shared.isRegisteredForRemoteNotifications==false{OneSignal.registerForPushNotifications()print("Notificationsiso

swift - 为什么强制展开会给我一个 EXC_BREAKPOINT (SIGTRAP) 错误?

我的应用程序在声明我的for循环forparticipantinevent.attendees!时崩溃。我对swift比较陌生,我知道如果我检查attendees数组不为nil,那么我可以自由地强制解包它。我在这里误解了什么?privatestaticfuncparseParticipants(event:EKEvent)->[Attendee]{varparticipants=[Attendee]()if(event.attendees!=nil&&event.attendees?.count!=0){forparticipantinevent.attendees!{letparti

swift - 创建自定义标签栏

我想在顶部创建一个自定义标签栏。就像9gag一样。你知道我可以学习如何做的地方吗?(文档或视频教程)谢谢9gagcustomtabbar 最佳答案 您可以使用CollectionView来创建类似这样的东西。方法如下:创建您的ViewController界面,如下面的屏幕截图所示:不要忘记将collectionview的滚动方向设置为水平2。将自定义CollectionView单元类创建为importUIKitclassCustomCollectionViewCell:UICollectionViewCell{//MARK:Outl

swift - 如何从 Cocoa 应用程序运行 Automator 工作流/服务?

所以我尝试很好地学习Swift以在其中重新创建我的程序,但效果并不好,我也没有走得太远。尝试通过调用函数从Obj-C++源代码运行我的C++函数,但没有用,并且项目在我第一次关闭后拒绝再次打开。我一开始并没有发现面向对象的编程非常直观,所以我想避免使用Obj-C。我已经拥有一个Automator独立工作流程和一个服务(做同样的事情),它获取我需要的程序,显示确认,在带有标准输出的终端窗口中运行程序,并在退出前显示通知。这是按下特定按钮时我需要它做的所有事情。那么我如何将此按钮链接到Swift中的Automatorfuncrun()block?我知道需要使用的命令,但就像我说的那样,我发

ios - Swift 3 LPCM 录音机 |错误 : kAudioFileInvalidPacketOffsetError

下面的录音机只在第一次工作,如果你尝试第二次录音,它会在尝试AudioFileWritePackets时给出错误“kAudioFileInvalidPacketOffsetError”。知道为什么会这样吗?提前致谢Repositorylocatedhere记录器importUIKitimportCoreAudioimportAudioToolboxclassSpeechRecorder:NSObject{staticletsharedInstance=SpeechRecorder()//MARK:-properties@objcenumStatus:Int{casereadycaseb

ios - Xcode Swift 将 String 从 popover View 传递给主 VC

我试图将数据从我的popOverViewController中的字符串传递回我的mainVC作为字符串。但我不知道该怎么做,所以请帮助任何人。我的mainVCsegue函数:overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){ifsegue.identifier=="popoverSegue"{letpopoverViewController=segue.destinationViewControllerpopoverViewController.modalPresentationStyle=UI

ios - Swift - 无法更新 UITabBar barTintColor

在viewDidLoad中,我尝试了以下方法来更新我的UITabBar的背景或“barTintColor”。我可以通过使用[[UITabBarappearance]setBarTintColor:[UIColorblackColor]];用objective-c做到这一点。我尝试过的:UITabBar.appearance().barTintColor=UIColor.whiteself.navigationController?.navigationBar.barTintColor=UIColor.white;UINavigationBar.appearance().barTintC

swift - Realm 列表过滤器 Swift

varnumbersDetail=LististypeofContactDetail()letpredicate=NSPredicate(format:ContactDetail.NUMBER+"=%@",formattedNumber!)letrealmContactDetail=numbersDetail.filter(predicate).first获取错误:throwRLMException("ThismethodmayonlybecalledonRLMArrayinstancesretrievedfromanRLMRealm"); 最佳答案

swift - 声明这些变量的合适位置在哪里?

这就是我目前声明变量的方式。我通常在需要时声明它们。//InstantiateMapletmap=MKMapView()map.frame=CGRect(x:0,y:0,width:view.frame.size.width,height:view.frame.size.height)//EditPropertiesmap.mapType=MKMapType.standardmap.isZoomEnabled=truemap.isScrollEnabled=true//Centermapinviewmap.center=view.center//GetcoordinatesfromAp