我无法修复persistence.xml file not foundeclipse问题,这是一个简单的测试项目(Maven Nature),用于非常基本的EJB测试,该文件确实在src/main/resources/META-INF/...这是pom.xml的内容.尝试将文件夹添加到项目的构建路径,更新maven项目.到目前为止没有运气,任何帮助将不胜感激,谢谢!
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>LibEE</groupId>
<artifactId>LibEE</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>main.resources.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.ow2.spec.ee</groupId>
<artifactId>ow2-ejb-3.0-spec</artifactId>
<version>1.0.13</version>
</dependency>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
这是persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="LibEE" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/LibEE</jta-data-source> <!-- Refers to data …Run Code Online (Sandbox Code Playgroud) 我有一个根本不滚动的UIScrollView.如果我启用弹跳,我可以向侧面滚动足够远以查看视图外部有内容,但是当我释放时它会快速回到原点.我打开了分页,但如果我将其关闭,我会得到相同的行为.我关闭了自动布局.在IB中,scrollView位于MainViewController中,正确链接到IBOutlet,如下所示.
@interface MainViewController ()
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;
@end
@implementation MainViewController
- (void)viewDidLoad
{
[super viewDidLoad];
for (int i = 0; i < 3; i++) {
CGRect frame;
frame.origin.x = self.scrollView.frame.size.width * i;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
// I might be doing this wrong, but it returns a PosterView object just like I want it to.
NSArray *view = [[NSBundle mainBundle] loadNibNamed:@"posterView" owner:self options:nil];
[[view objectAtIndex:0] setFrame:frame];
[self.scrollView addSubview:[view objectAtIndex:0]];
}
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * 3, …Run Code Online (Sandbox Code Playgroud) 大家好,我正在尝试验证objective-c中的名字.请注意,名称可以包含空格和仅包含字母.
这里我的代码不起作用:
NSString *nameRegex = @"^[A-Z][a-z]*[\\s{L}\\s{M}\\s{Nl}][A-Z][a-z]*$";
NSPredicate *nameTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", nameRegex];
BOOL isValid = [nameTest evaluateWithObject:name];
return isValid;
Run Code Online (Sandbox Code Playgroud) 我正在MKLocalSearch执行地图搜索。我的问题是响应中MKMapItems的排序。例如,搜索我当前所在的城市将首先返回许多与城市名称有关的业务,而我必须向下滚动一会才能找到实际的城市。我正在使用的region属性MKLocalSearchRequest将搜索集中在附近区域。
我的问题是:
不知道是否相关,但是这里是搜索的代码:
-(void)issueLocalSearchLookup:(NSString *)searchString {
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(self.location.coordinate, 30000, 30000);
self.localSearchRequest = [[MKLocalSearchRequest alloc] init];
self.localSearchRequest.region = region;
self.localSearchRequest.naturalLanguageQuery = searchString;
self.localSearch = [[MKLocalSearch alloc] initWithRequest:self.localSearchRequest];
[self.localSearch startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
if(error){
NSLog(@"LocalSearch failed with error: %@", error);
return;
} else {
for(MKMapItem *mapItem in response.mapItems){
[self.data addObject:mapItem];
}
[self.searchDisplayController.searchResultsTableView reloadData];
}
}];
}
Run Code Online (Sandbox Code Playgroud) 有没有一种简单的方法来找出某个函数停止使用的提交?我发现我以为我正在使用的函数已经很多次了,但是似乎什么也没有调用它,这让我想知道何时以及为什么要这样做。
我有不同的视图层次结构UIGestureRecognizers。有时其中一个会停止工作,我正在寻找一种有效的方法来调试它。由于UIGestureRecognizers通常的被动性质,我总是发现它们很难调试。如果一个人停止工作,我能想到的两件事就是
touchesBegan:withEvent:所有相关视图以尝试追踪触摸的传递不过,这些有时并不能解决问题,就像目前的情况一样,我UITapGestureRecognizer有时(我相信在呈现和驳回视图之后)会在应用程序运行时停止工作。
我正在制作一个支持视频播放和录制的应用程序。除了视频播放期间,我总是希望允许背景音频混合(在播放过程中,背景音频应该静音)。因此,我在更改播放状态时使用以下两种方法。当我的 AVPlayer 开始加载时,我调用MuteBackgroundAudio,当我关闭包含它的视图控制器时,我调用ResumeBackgroundAudio. 这按预期工作,离开播放后音频成功返回。
问题是,在至少执行一次此操作后,每当我使用 录制任何内容时AVCaptureSession,都不会录制任何声音。我的会话配置如下:
AVCaptureDevice *audioDevice = [[AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio] firstObject];
AVCaptureDeviceInput *audioDeviceInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:&error];
if (error)
{
NSLog(@"%@", error);
}
if ([self.session canAddInput:audioDeviceInput])
{
[self.session addInput:audioDeviceInput];
}
[self.session setAutomaticallyConfiguresApplicationAudioSession:NO];
// ... videoDeviceInput
Run Code Online (Sandbox Code Playgroud)
请注意,我尚未设置usesApplicationAudioSession,因此默认为YES.
void MuteBackgroundAudio(void)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
if ([[AVAudioSession sharedInstance] isOtherAudioPlaying] && !isMuted)
{
isMuted = YES;
NSError *error = nil;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker
error:&error];
if (error)
{
NSLog(@"DEBUG - Set category error …Run Code Online (Sandbox Code Playgroud) 是否有可能以编程方式回答iPhone中的呼叫?我已经搜索过这个,发现iOS SDK不支持这样的功能.但我在Appstore找到了一个应答机应用程序.
https://itunes.apple.com/in/app/prank-answering-machine-free/id508457142?mt=8
请帮帮我.
FBSDKLoginKit通过CocoaPods 安装后,我得到了构建错误
选择器'areAllPermissionsReadPermissions:'没有已知的类方法
没有已知的选择器类的方法'areAllPermissionsPublishPermissions:'
两者都位于/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.m.
FBSDKCoreKit也是通过CocoaPods安装的.
我检查的内容如下:
Link Binary With LibrariesFBSDKLoginKit/FBSDKLoginKit.h
而不会出错谁看过这个吗?
我正在实施水龙头以集中精力,并为如何使用不同而感到困惑AVCaptureFocusModes。这样做:
[device setFocusPointOfInterest:focusPoint];
[device setFocusMode:AVCaptureFocusModeAutoFocus];
Run Code Online (Sandbox Code Playgroud)
可以成功对焦,但是由于锁定焦距,移动相机将永远失去对焦。相反,如果我这样做:
[device setFocusPointOfInterest:focusPoint];
[device setFocusMode:AVCaptureFocusModeContinousAutoFocus];
Run Code Online (Sandbox Code Playgroud)
自动对焦引擎似乎消除了我的兴趣,只专注于看起来最好的东西。相机应用程序成功聚焦在您的兴趣点上,同时在移动相机时也保持连续自动对焦,这是怎么做的?
到目前为止,这是我的完整代码:
- (void)setFocusPointOfInterest:(CGPoint)point
{
Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
if (captureDeviceClass != nil) {
AVCaptureDevice *device = [captureDeviceClass defaultDeviceWithMediaType:AVMediaTypeVideo];
if([device isFocusPointOfInterestSupported] &&
[device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
CGRect screenRect = [[UIScreen mainScreen] bounds];
double screenWidth = screenRect.size.width;
double screenHeight = screenRect.size.height;
double focus_x = point.x/screenWidth;
double focus_y = point.y/screenHeight;
CGPoint focusPoint = CGPointMake(focus_x,focus_y);
if([device lockForConfiguration:nil]) {
[device setFocusPointOfInterest:focusPoint];
[device setFocusMode:AVCaptureFocusModeAutoFocus];
[device setExposurePointOfInterest:focusPoint];
if ([device isExposureModeSupported:AVCaptureExposureModeAutoExpose]){
[device setExposureMode:AVCaptureExposureModeAutoExpose];
}
[device unlockForConfiguration]; …Run Code Online (Sandbox Code Playgroud) ios ×8
iphone ×3
objective-c ×2
avfoundation ×1
eclipse ×1
fbsdk ×1
git ×1
ios7 ×1
java ×1
jpa ×1
mapkit ×1
maven ×1
regex ×1
uiscrollview ×1