我已经为我的应用程序完成了基本通知.我想在我的通知中添加声音效果.
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
if (localNotification == nil)
return;
localNotification.fireDate = [NSDate date];
//localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = msg;
localNotification.soundName = @"Morse.aiff";
[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
Run Code Online (Sandbox Code Playgroud)
如何添加音效?
我正在创建我的第一个ASP.NET MVC项目。我已经开始连接TFS并通过C#将错误添加到TFS中。
var tfsURI = new Uri("http://test:8080/tfs");
var networkCredential1 = new NetworkCredential("test", "test!");
ICredentials credential = (ICredentials)networkCredential1;
Microsoft.VisualStudio.Services.Common.WindowsCredential winCred = new Microsoft.VisualStudio.Services.Common.WindowsCredential(credential);
VssCredentials vssCredentials = new VssCredentials(winCred);
using (TfsTeamProjectCollection collection = new TfsTeamProjectCollection(tfsURI, vssCredentials))
{
collection.EnsureAuthenticated();
WorkItemStore workItemStore = collection.GetService<WorkItemStore>();
Project teamProject = workItemStore.Projects["Test"];
WorkItemType workItemType = teamProject.WorkItemTypes["Bug"];
WorkItem Defect = new WorkItem(workItemType);
FileInfo fi = new FileInfo(@"C:\\Document.docx");
Attachment tfsAttachment = new Attachment(fi.FullName);
Defect.Attachments.Add(tfsAttachment);
Defect.Title = "Testing from VS to TFS Bug";
Defect.Description = "Testing from VS to entered Bug …Run Code Online (Sandbox Code Playgroud) 我从 React Native 项目开始,之前是在本机代码中。我想添加 Amazon Lex,所以按照链接中的以下步骤操作
https://aws-amplify.github.io/docs/js/interactions
下面是我的 App.js 文件
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Run Code Online (Sandbox Code Playgroud)
我刚刚设置了放大库并为 LEX 添加了交互,但是当我尝试运行应用程序时开始出现以下错误。在添加之前工作正常......一旦Amplify文件夹被创建并开始出现后端错误......
(节点:26180)未处理的PromiseRejectionWarning:错误:jest-haste-map:Haste模块命名冲突:重复模块名称:myamplifyproject_cfnlambda_87887b9a 路径:C:\Users\temp\Desktop\myAmplifyProject\amplify\backend\interactions\packagefdsrc\6 json 与 C:\Users\temp\Desktop\myAmplifyProject\amplify#current-cloud-backend\interactions\lex900662fd\src\package.json 发生冲突
这个错误是由
hasteImpl为不同的文件返回相同的名称。在 setModule (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-haste-map\build\index.js:569:17) at workerReply (C:\Users\temp\Desktop\myAmplifyProject\node_modules\jest-匆忙映射\build\index.js:641:9) at processTicksAndRejections (internal/process/task_queues.js:93:5) at …
javascript amazon-web-services aws-sdk aws-lambda react-native
我在我的iPad App中使用CLLocationManager类来获取当前位置.
我使用下面的代码来获取地址详细信息,
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSUserDefaults *oIsLocation = [NSUserDefaults standardUserDefaults];
if([oIsLocation boolForKey:@"IsLocation"])
{
NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow];
if (locationAge > 5.0) return;
if (newLocation.horizontalAccuracy < 0) return;
if (bestEffortAtLocation == nil || bestEffortAtLocation.horizontalAccuracy > newLocation.horizontalAccuracy)
{
if(bestEffortAtLocation.coordinate.latitude != newLocation.coordinate.latitude && bestEffortAtLocation.coordinate.longitude != newLocation.coordinate.longitude)
{
[self saveLocation:newLocation];
self.bestEffortAtLocation = newLocation;
[self saveUserLocation];
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在进行反向地理编码以获取详细信息如下:
NSLog(@"placemark.ISOcountryCode %@",placemark.ISOcountryCode);
NSLog(@"placemark.country %@",placemark.country);
NSLog(@"placemark.postalCode %@",placemark.postalCode);
NSLog(@"placemark.administrativeArea %@",placemark.administrativeArea);
NSLog(@"placemark.locality %@",placemark.locality);
NSLog(@"placemark.subLocality %@",placemark.subLocality);
NSLog(@"placemark.subThoroughfare %@",placemark.subThoroughfare);
Run Code Online (Sandbox Code Playgroud)
placemark.locality给出了城市名称,但没有全名,如北卡罗来纳州只有NC.
当我的客户在美国使用应用程序时,而不是像"北卡罗莱纳州"这样的全名,他们获得NC,圣查尔斯获得圣查尔斯等.
有没有办法获得全名?
我有一个字符串数组,如:Array = P123,P234,P543,P678
我有像P12300这样的字符串.(这可以是数组内的相同字符串,也可以没有trailling零).
我正在使用containsObject
if(Array containsObject: P123) ==> TRUE
if(Array containsObject: P23400) ==> FALSE
if(Array containsObject: P1230) ==> FALSE
Run Code Online (Sandbox Code Playgroud)
是否有更好的方法来比较字符串,以便所有情况的上述情况都是真的?
目前我正在使用containsObject,并且我没有得到期望的结果,因为条件仅对于完全相同的字符串才是真的.
请让我知道好方法..
下面是我用来获取DatetimeiPad应用程序的欲望结果的代码,但是它给了我正确的日期但是关于时间它没有显示正确的值.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.mmm"];
NSDate *date = [dateFormatter dateFromString:@"2009-06-02 08:24:27.000"];
[dateFormatter setDateFormat:@"MM/dd/yyyy h:mm a"];
NSLog(@"Your converted date - %@",[dateFormatter stringFromDate:date]);
Run Code Online (Sandbox Code Playgroud)
您的转换日期 - 06/02/2009 8:00 AM
Plz注意Minutes显示不正确...它总是显示00值.
ios ×4
objective-c ×3
.net ×1
aws-lambda ×1
aws-sdk ×1
c# ×1
cllocation ×1
javascript ×1
react-native ×1
sql ×1
sql-server ×1
tfs ×1