=== 编辑 ========
现在,Xcode 8.1解决了这个问题.我检查过.
================
我不知道自动布局是否正确.所以,我在我的所有应用程序中使用自动调整选项,这对我来说很好.我能够毫无问题地满足我的所有要求.
现在在Xcode 8中,我已经将我的旧swift项目迁移到swift 3.现在出现了问题.
看到图片,我已经设置了Autoresizing,并且它在所有设备中都没有问题,直到现在这个项目都在AppStore中,所以我无法显示UI或故事板.
现在我必须在项目中做一些更新.所以我现在正在使用Xcode 8.但我的autoresizing不能正常工作,因为所有的控件都在中心,UI搞砸了.
这个问题在设备中也存在.我也检查了模拟器和设备.但问题也存在.任何建议和帮助将不胜感激.提前致谢.
编辑:
昨天在运行时只有问题,但今天的故事板也改变了这个图像的视图
这意味着整个UI设计搞砸了.这很奇怪.
我在Xcode 7.3中使用swift 2.2版本进行了工作.现在我已经更新了Xcode 8并迁移到swift 3.现在我的项目包含特别针对像afnetworking成功块这样的块的错误.
这给出了错误
Cannot convert value of type '() -> ()' to expected argument type '((URLSessionDataTask, Any?) -> Void)?'
Run Code Online (Sandbox Code Playgroud)
根据swift 3,我不明白如何解决这个问题.
Facebook登录也有同样的错误.
这给出了错误
Cannot convert value of type '(FBSDKLoginManagerLoginResult!, NSError!) -> Void' to expected argument type 'FBSDKLoginManagerRequestTokenHandler!'
Run Code Online (Sandbox Code Playgroud)
和
Cannot convert value of type '(_, _, NSError!) -> Void' to expected argument type 'FBSDKGraphRequestHandler!'
Run Code Online (Sandbox Code Playgroud)
这个所有错误都与swift 3中的处理程序块有关.我不理解错误,因此无法解决.任何帮助将不胜感激.提前致谢.
我已经在 iOS 中使用 VoIP PushKit 实现了用于音频和视频通话的 CallKit,它在 iOS 12 和之前的版本中运行良好,在 iOS 13 和 13.1 中也运行正常。
但它在两种情况下失败:
1)我们的应用程序处于前台状态。当蜂窝电话正在运行并且收到 VoIP 推送时,呼叫套件来电屏幕会显示 5 - 10 秒,然后蜂窝电话和 VOIP 通话都失败并显示“呼叫失败”警报。
2)我们的应用程序处于后台或已终止状态。当蜂窝电话正在运行并且收到 VoIP 推送时,蜂窝电话和 VOIP 通话都会失败,并显示“呼叫失败”警报。这次没有显示来电界面。
我在这里展示我的代码:
- (void)registerAppForVOIPPush {
PKPushRegistry *pushRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
pushRegistry.delegate = self;
pushRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
}
Run Code Online (Sandbox Code Playgroud)
然后推送代表
#pragma mark PKPushRegistryDelegate ----
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials: (PKPushCredentials *)credentials forType:(NSString *)type {
NSString *newToken = [self hexadecimalStringFromData:credentials.token];
//Make a note of this token to a server to send VOIP for …
Run Code Online (Sandbox Code Playgroud) 在我的项目中,我需要在Web服务API调用中发送JSON对象.我已经从数组转换了JSON.
do {
let theJSONData = try NSJSONSerialization.dataWithJSONObject(
param ,
options: NSJSONWritingOptions(rawValue: 0))
var theJSONText : String = String(data: theJSONData,
encoding: NSASCIIStringEncoding)!
print(theJSONText)
theJSONText = theJSONText.stringByReplacingOccurrencesOfString("\\", withString: "", options: NSStringCompareOptions.LiteralSearch, range: nil)
print(theJSONText)
let newParam = ["ESignData":theJSONText]
} catch let error as NSError {
print(error)
}
Run Code Online (Sandbox Code Playgroud)
它正确打印字符串为
{"EntNum":"47","JobNo":"1737753","ClientID":"100","HospNo":"1","QAReason":"","DoctorNo":"1694","Action":"Sign"}
{"EntNum":"47","JobNo":"1737753","ClientID":"100","HospNo":"1","QAReason":"","DoctorNo":"1694","Action":"Sign"}
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试newParam
在API调用中发送此字典时,它在JSON字符串的字符串参数中包含"\".
WebService.PostURL(mainLink, methodname: ESIGNTHISDOC, param: newParam, userName: AUTH_USERNAME, password: AUTH_PWD, CompletionHandler: { (success, response) in
})
Run Code Online (Sandbox Code Playgroud)
在那个Web服务方法中,我有打印参数.
Param = {
ESignData = "{\"EntNum\":\"47\",\"JobNo\":\"1737753\",\"ClientID\":\"100\",\"HospNo\":\"1\",\"QAReason\":\"\",\"DoctorNo\":\"1694\",\"Action\":\"Sign\"}";
}
Run Code Online (Sandbox Code Playgroud)
现在我知道这在iOS中是显而易见的,因为"在字符串中.现在问题是在Android应用程序中有很多API工作,并且API开发人员不想根据我们更新他的代码.
我知道这个问题的发生是因为在字典中添加JSON字符串作为参数.但我没有正确的理由,所以如果有任何证据也有助于我说服他.
在iOS中没有反斜杠转换JSON字符串的任何解决方案?如果可能的话,我需要从我身边修好.任何帮助将不胜感激.
编辑:
在服务器端它需要像 …
我看过对问题的更新程序徽章在午夜选项:应用程序无法启动或背景,徽章数量可能减少 ,并更改应用程序图标徽章时通知到达 和推送通知徽章计数不更新 和更新徽章图标当应用程序被关闭,许多更多,但我有同样的问题,当应用程序在后台和推送通知到达时,应用程序徽章图标不更新.
我检查了所有可能性.我的代码是:
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
UIApplicationState appState = UIApplicationStateActive;
if ([application respondsToSelector:@selector(applicationState)]) {
appState = application.applicationState;
}
for (id key in userInfo) {
NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
}
NSLog(@"remote notification: %@",[userInfo description]);
[UIApplication sharedApplication].applicationIconBadgeNumber = [[[userInfo valueForKey:@"aps"] valueForKey:@"badge"] integerValue];
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive)
{
NSString *message = [[userInfo valueForKey:@"aps"] valueForKey:@"alert"];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@""
message:message
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show]; …
Run Code Online (Sandbox Code Playgroud) 我有应用程序,我必须在默认日历中添加事件,直到iOS 10正常.现在在iOS 10中它不授予访问权限.我已经开始use legacy swift language version
了yes
.我的代码是
let eventStore = EKEventStore()
switch EKEventStore.authorizationStatusForEntityType(EKEntityType.Event) {
case .Authorized:
//access
case .Denied:
print("Access denied")
case .NotDetermined:
eventStore.requestAccessToEntityType(EKEntityType.Event, completion:
{[weak self] (granted: Bool, error: NSError?) -> Void in
if granted {
//access
} else {
print("Access denied")
}
})
default:
print("Case Default")
}
Run Code Online (Sandbox Code Playgroud)
调试我的应用程序eventStore.requestAccessToEntityType
在Xcode 8中崩溃.
我的应用程序是实时的,我需要解决它.任何帮助都是适当的.提前致谢.
我在我的一个应用程序中集成了Touch ID访问。我已经成功整合了它。这是该代码:
dispatch_queue_t highPriorityQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.75 * NSEC_PER_SEC), highPriorityQueue, ^{
dispatch_async(dispatch_get_main_queue(), ^{
LAContext *context = [[LAContext alloc] init];
isTouchExists = [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil];
if (isTouchExists) {
NSString * keychainItemIdentifier;
NSString * keychainItemServiceName;
keychainItemIdentifier = @"fingerprintKeychainEntry";
keychainItemServiceName = [[NSBundle mainBundle] bundleIdentifier];
NSData * pwData = [@"the password itself does not matter" dataUsingEncoding:NSUTF8StringEncoding];
NSMutableDictionary * attributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
(__bridge id)(kSecClassGenericPassword), kSecClass,
keychainItemIdentifier, kSecAttrAccount,
keychainItemServiceName, kSecAttrService, nil];
CFErrorRef accessControlError = NULL;
SecAccessControlRef accessControlRef = SecAccessControlCreateWithFlags(
kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
kSecAccessControlUserPresence, …
Run Code Online (Sandbox Code Playgroud) ios ×6
iphone ×2
objective-c ×2
swift ×2
swift3 ×2
xcode8 ×2
afnetworking ×1
autoresize ×1
badge ×1
calendar ×1
callkit ×1
ekevent ×1
ekeventstore ×1
facebook ×1
fingerprint ×1
ios13 ×1
json ×1
pushkit ×1
storyboard ×1
touch-id ×1
voip ×1
web-services ×1