Questions tagged «ios»

iOS是在Apple iPhone,iPod touch和iPad上运行的移动操作系统。使用此标签[ios]来解决与iOS平台上的编程有关的问题。使用相关的标签[objective-c]和[swift]解决那些编程语言所特有的问题。




5
iOS:在代码中访问app-info.plist变量
我正在开发通用应用程序,并且想在我的代码中访问存储在app-info.plist文件中的值。 原因:我使用以下示例从故事板动态实例化UIViewController: UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil]; self = [storyboard instantiateViewControllerWithIdentifier:@"ExampleViewController"]; 现在,上面的故事板名称为@“ MainStoryboard_iPhone”很难看。 我想做类似的事情: UIStoryboard* storyboard = [UIStoryboard storyboardWithName:appInfo.mainStoryboardBaseNamePhone bundle:nil]; self = [storyboard instantiateViewControllerWithIdentifier:@"ExampleViewController"]; 其中appInfo可能是app-info.plist中所有值的NSDictionary

5
“%不可用:改为使用truncatingRemainder”是什么意思?
使用扩展代码时,出现以下错误,我不确定他们是否要求使用其他运算符或基于Internet搜索修改表达式中的值。 错误:%不可用:改用truncatingRemainder 扩展代码: extension CMTime { var durationText:String { let totalSeconds = CMTimeGetSeconds(self) let hours:Int = Int(totalSeconds / 3600) let minutes:Int = Int(totalSeconds % 3600 / 60) let seconds:Int = Int(totalSeconds % 60) if hours > 0 { return String(format: "%i:%02i:%02i", hours, minutes, seconds) } else { return String(format: "%02i:%02i", …
103 ios  swift  swift3  modulus 

9
在应用商店上找不到适用于应用程序的有效“ aps-environment”权利字符串
因此,我有一个名为Dripper的应用程序,大约一个月前发布了,几天前又进行了更新。此更新添加了推送通知和一些小调整。我使用开发配置文件在sandbox-apn上对其进行了测试,并且一切正常。然后,我将其切换到生产应用程序并将其推向试飞状态,再次一切正常。一旦我将更新发布到市场上并运行它,我注意到我在服务器上没有任何新的推送注册。我查看了设备的控制台日志,发现了这一点: 12月4日17:55:15 Ina-touch-it coffco [1210]:注册远程通知 12月4日17:55:15 Ina-touch-it SpringBoard [52]:未找到适用的有效“ aps-environment”授权字符串'滴头':(空)。通知将不会传递。 12月4日17:55:15 Ina-touch-it coffco [1210]<Warning>: Failed to register with error : Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x174270900 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application} 我有点困惑,因为我认为在正式版和应用商店构建之间,Production-apn的功能相同。 这是我的应用程序ID及其权利-> http://i.stack.imgur.com/uf4pB.png 这是应用商店的配置文件-> http://i.stack.imgur.com/AYOV5.png

9
Swift-如何在导航项中隐藏后退按钮?
现在我有两个视图控制器。我的问题是,在转换到第二个视图控制器后,我不知道如何隐藏后退按钮。我发现的大多数参考都在Objective-C中。如何在Swift中编写代码? 在Objective-C中隐藏后退按钮代码 [self.navigationItem setHidesBackButton:YES animated:YES];
103 ios  swift  xcode6 

30
Xcode项目未显示模拟器列表
我在Xcode 6.1中打开我的项目。当我尝试运行项目时,该按钮显示为灰色。当我尝试转到时Product > Clean,该选项显示为灰色。当我查看模拟器列表时,我得到的只是My Mac通常的iOS Device。如何让模拟器回来?
103 ios  xcode  xcode6.1 

13
删除图像中的Alpha通道
我有一个适用于iOS的应用程序图标,但Apple不允许Alpha出现在图像中。如何删除此Alpha通道?我只有PNG图片,没有源文件,因为我的朋友为我制作了图片。
103 ios  image  alpha 

9
iOS 7中的自定义字体
我正在开发游戏,我想在我的应用中使用自定义字体。如果这很重要,我正在使用SpriteKit。我已经尝试过使用此https://github.com/deni2s/IBCustomFonts,但是我无法使用此字体http://www.fontspace.com/freaky-fonts/emulogic 我已经尝试过各种方法,并且已经在应用程序的info.plist中注册了字体。有人知道发生了什么吗?
102 ios  iphone  fonts 

5
使用UIImagePickerController时,iOS 10错误[访问] <私有>
我正在使用XCode 8并在iOS 10.2 Beta中进行测试。 我已将Photos,PhotosUI和MobileCoreServices框架添加到项目中。 很简单的代码: #import &lt;Photos/Photos.h&gt; #import &lt;PhotosUI/PhotosUI.h&gt; #import &lt;MobileCoreServices/MobileCoreServices.h&gt; @interface ViewController : UIViewController &lt;UIImagePickerControllerDelegate, UINavigationControllerDelegate, PHLivePhotoViewDelegate&gt; @property (strong, nonatomic) IBOutlet UIImageView *imageview; @end 和实现: - (IBAction)grab:(UIButton *)sender{ UIImagePickerController *picker = [[UIImagePickerController alloc]init]; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.allowsEditing = NO; picker.delegate = self; // make sure we include Live …

8
Xcode 6-从命令行启动模拟器
我想从命令行启动iPhone模拟器。 到目前为止,我一直在使用以下命令 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SimulateDevice -SimulateDevice用于启动特定的设备类型 现在,使用Xcode 6,路径和应用已更改为 /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app/Contents/MacOS/iOS Simulator 但可悲的是-SimulateDevice选项现在无法使用。我可以启动模拟器,但是没有指定要启动哪个模拟器的选项 有人用Xcode 6找到了替代方法吗?


7
Swift上的块(animateWithDuration:animations:completion :)
我在使块在Swift上无法工作时遇到了麻烦。这是一个有效的示例(没有完成框): UIView.animateWithDuration(0.07) { self.someButton.alpha = 1 } 或者没有尾随闭包: UIView.animateWithDuration(0.2, animations: { self.someButton.alpha = 1 }) 但是一旦我尝试添加完成块,它将无法正常工作: UIView.animateWithDuration(0.2, animations: { self.blurBg.alpha = 1 }, completion: { self.blurBg.hidden = true }) 自动完成功能给了我,completion: ((Bool) -&gt; Void)?但不确定如何使它起作用。还尝试了结尾闭包,但出现了相同的错误: ! Could not find an overload for 'animateWithDuration that accepts the supplied arguments Swift 3/4的更新: // This …
102 ios  swift  closures 

14
Xcode 5和资产目录:如何引用LaunchImage?
我正在使用Xcode 5的资产目录,并且希望将其用LaunchImage作主视图的背景图像(一种非常常见的做法是使从“加载”到“加载”的过渡看起来很平滑)。 我想在资产目录中使用相同的条目来节省空间,而不必在两个不同的图像集中复制该图像。 但是,调用: UIImage *image = [UIImage imageNamed:@"LaunchImage"]; //returns nil

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.