Questions tagged «iphone»

除非要专门针对Apple的iPhone和/或iPod touch,否则请勿使用此标签。对于不依赖于硬件的问题,请使用标签[ios]。需要考虑的更多标签是[xcode](但仅当问题与IDE本身有关时),[swift],[objective-c]或[cocoa-touch](但不包括[cocoa])。请避免有关iTunes App Store或iTunes Connect的问题。如果使用C#,请使用[mono]进行标记。


30
无效的iPhone应用程序二进制文件
我正在尝试将应用程序上载到iPhone App Store,但是我从iTunes Connect收到此错误消息: 您上传的二进制文件无效。签名无效,或者未使用Apple提交证书签名。 注意:原始问题的详细信息已删除,因为此页面已变成存储库,以存储有关该特定错误消息可能原因的所有信息。 有关将iPhone应用程序提交到App Store的常规信息,请参阅将iPhone应用程序上传到AppStore的步骤。



7
使用Swift在iOS中发送短信
首先,我真的很惊讶这不是重复的,因为在Objective-C中有大量的堆栈溢出问题可以解决这个问题,但是我还没有看到使用Swift的好答案。 我正在寻找的是Swift中的代码段,该代码段将任意字符串作为文本消息的主体发送到给定的电话号码。从本质上讲,我希望像这样从苹果的官方文档,但是在斯威夫特,而不是Objective-C的。 我认为这并不难,因为可以在Android中仅用几行代码就可以完成。 编辑:我正在寻找的是5-20行Swift代码,我不同意这个范围太广。在Java(适用于Android)中,解决方案如下所示: package com.company.appname; import android.app.Activity; import android.telephony.SmsManager; public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); public static final mPhoneNumber = "1111111111"; public static final mMessage = "hello phone"; SmsManager.getDefault().sendTextMessage(mPhoneNumber, null, mMessage, null, null); } } 现在这是android解决方案,只有11行。Java往往比Swift更冗长,因此我怀疑我要问的是“范围太广”,很可能我不知道如何使用Objective-C MessageComposer对象,因为我链接的文档关于Swift中的用法,上述内容尚不清楚。
78 ios  swift  iphone  sms  imessage 

4
在iOS上写入文件
如何在iOS上写入文件?我正在尝试使用下面的代码来做,但是我做错了什么: char *saves = "abcd"; NSData *data = [[NSData alloc] initWithBytes:saves length:4]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"MyFile"]; [data writeToFile:appFile atomically:YES]; 我在资源上创建了MyFile.txt。
78 ios  iphone  file  nsbundle 

3
使用Xcode的All Exceptions断点时忽略某些异常
我在Xcode中配置了一个All Exceptions断点: 有时Xcode会停在以下行中: [managedObjectContext save:&error]; 具有以下回溯: 但如果您单击“继续”,程序将继续运行,好像什么都没发生。 如何忽略这些“常规”异常,但仍然让调试器停止自己代码中的异常? (我知道发生这种情况是因为Core Data在内部抛出并捕获了异常,并且Xcode只是在每次抛出异常时都接受我的暂停程序的请求。但是,我想忽略这些,以便回到调试自己的代码上!) 主持人:这类似于“ Xcode 4异常断点过滤”,但是我认为这个问题花很长时间才能解决问题,并且没有任何有用的答案。它们可以链接吗?
78 iphone  ios  xcode 





9
Swift默认AlertViewController突破约束
我正在尝试使用.actionSheet样式的默认AlertViewController。由于某种原因,警报导致约束错误。只要没有通过按钮触发(显示)alertController,整个视图就不会出现约束错误。难道这是Xcode的错误? 我得到的确切错误是这样的: 2019-04-12 15:33:29.584076+0200 Appname[4688:39368] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the …

3
UILabel中文本的像素宽度
我需要绘制一个删除的UILabel。因此,我将UILabel子类化,并按如下方式实现它: @implementation UIStrikedLabel - (void)drawTextInRect:(CGRect)rect{ [super drawTextInRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextFillRect(context,CGRectMake(0,rect.size.height/2,rect.size.width,1)); } @end 发生的情况是,UILabel的行与整个标签一样长,但是文本可以更短。有没有一种方法可以确定文本的长度(以像素为单位),以便可以适当地绘制线条? 我也愿意接受其他解决方案,如果知道的话:) 最好,埃里克

7
AFNetworking 2.0将标头添加到GET请求
我刚刚开始使用AFNetworking 2.0,并且想知道如何将标头放入HTTP Get请求中。该文档设置了这样的GET: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSDictionary *parameters = @{@"foo": @"bar"}; [manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Error: %@", error); }]; 但是由于我们没有处理,NSURLRequests所以我不确定如何设置HTTP标头。 任何帮助,将不胜感激。 问候,迈克

4
如何更改uitableview删除按钮文本
嗨,我正在尝试更改当用户在我的表格视图内滑动uitableviewcell时在“删除”按钮中显示的文本。 我在另一个问题线程中看到了一个示例,该示例说要使用此tableview委托 - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath 我的问题是,如何使用此方法。我不确定如何使用此方法。

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.