我从设备中取出的iPad崩溃中获得了以下堆栈跟踪.这是从用户的iPad中提取的,我不知道它们崩溃时他们在做什么.我如何获得有关应用程序崩溃和修复的原因/位置的更多信息?
Uncaught C++ Exception Stack trace: 0 - 0 MyApp 0x00005ac1 _Z16TerminateHandlerv + 24 1 - 1 libstdc++.6.dylib 0x33814e3d _ZN10__cxxabiv111__terminateEPFvvE + 52 2 - 2 libstdc++.6.dylib 0x33814e91 _ZSt9terminatev + 16 3 - 3 libstdc++.6.dylib 0x33814f61 __cxa_throw + 84 4 - 4 libobjc.A.dylib 0x3441dc8b objc_exception_throw + 70 5 - 5 Foundation 0x3645192b __NSThreadPerformPerform + 654 6 - 6 CoreFoundation 0x34e16a79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12 7 - 7 CoreFoundation 0x34e1875f __CFRunLoopDoSources0 + 382 8 - 8 CoreFoundation 0x34e194eb __CFRunLoopRun + 230 9 - …
什么是superview,什么是子视图?
当我添加此代码时:
[self.view addSubview:self.frontView];
// what does that mean ?
Run Code Online (Sandbox Code Playgroud)
和...
@property (nonatomic, strong) IBOutlet UIImageView *frontView;
[self.frontView superview] != nil // means ?
Run Code Online (Sandbox Code Playgroud)
在superview中是什么?
我想在Objective-C iPhone应用程序中使用一些C++ STL集合.显然,这可以通过为文件提供扩展名".mm"来实现.有什么与此相关的怪癖/惊喜?
我想使用我熟悉的基本容器(矢量,队列,集合......)
干杯!
我经历过Objective-C++的一些奇怪的行为.我有一个Objective-C++类,它在方法体中调用经典的C函数.但是链接器找不到C函数.
我在这里描述了这个问题: 在Objective-C方法体中使用的C函数找不到Xcode打印符号
我通过将Objective-C++类更改为Objective-C类来解决问题,但问题仍然存在.是否禁止在Objective-C++类中调用C函数?
我刚刚将编译器选项从4.0更改为4.2.
现在我收到一个错误:
jump to case label crosses initialization of 'const char* selectorName'
Run Code Online (Sandbox Code Playgroud)
它在4.0中运行良好
有任何想法吗?
Cocoa使用typedef-ed匿名枚举位域.
我正在使用Objective-C++,无论好坏.在.mm文件中,我需要将2位(按位包含OR)分配给这些枚举位域类型之一的类型的属性.libc ++编译器不会拥有它,因为它不会为该typedef-ed匿名枚举位域的属性提供类型为int的rvalue.
我知道C&C++之间存在枚举的大小差异.那么这种情况的解决方法是什么?
执行作业的我的行类似于:
uiSwipeRightDownRecogniser.direction = Right | Down;
Run Code Online (Sandbox Code Playgroud)
位域的定义类似于:
typedef enum
{
Right = 1 << 0,
Left = 1 << 1,
Up = 1 << 2,
Down = 1 << 3
} UISwipeDirection;
Run Code Online (Sandbox Code Playgroud)
错误是:
无法使用类型为'int'的rvalue初始化'UISwipeDirection'类型的参数
这种赋值在.m文件中工作,但不是.mm.
编译器是Apple的LLVM 3.0(使用libc ++).
在哪里可以找到关于在Objective-C中使用C++的具体文档或dos和donts文档?
Apple似乎已经从他们的网站上删除了该文档,我很困惑地整理了博客中的一些信息和这里发布的问题.
任何人都可以指导相同的事情.
我们何时使用.mm文件,同时混合语法或在.m文件中使用属于C++类的对象?
虽然在属于两种不同语言的函数之间传递对象,比如将objective-c对象传递给cpp文件中的函数,但是有必要在void*中收集它,或者我可以使用(ObjectiveC inteface)*?
我想将两个音频文件连接成一个.我做了以下代码.请检查下面.
- (BOOL)combineFiles{
AVMutableComposition *composition = [[AVMutableComposition alloc] init];
AVMutableCompositionTrack *compositionAudioTrack = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
[compositionAudioTrack setPreferredVolume:0.8];
NSString *soundOne =[[NSBundle mainBundle]pathForResource:@"test1" ofType:@"m4a"];
NSURL *url = [NSURL fileURLWithPath:soundOne];
AVAsset *avAsset = [AVURLAsset URLAssetWithURL:url options:nil];
AVAssetTrack *clipAudioTrack = [[avAsset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
[compositionAudioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, avAsset.duration) ofTrack:clipAudioTrack atTime:kCMTimeZero error:nil];
AVMutableCompositionTrack *compositionAudioTrack1 = [composition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];
[compositionAudioTrack1 setPreferredVolume:0.8];
NSString *soundOne1 =[[NSBundle mainBundle]pathForResource:@"test2" ofType:@"m4a"];
NSURL *url1 = [NSURL fileURLWithPath:soundOne1];
AVAsset *avAsset1 = [AVURLAsset URLAssetWithURL:url1 options:nil];
AVAssetTrack *clipAudioTrack1 = [[avAsset1 tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
[compositionAudioTrack1 insertTimeRange:CMTimeRangeMake(kCMTimeZero, avAsset.duration) ofTrack:clipAudioTrack1 atTime:kCMTimeZero …Run Code Online (Sandbox Code Playgroud) 在我的项目中,我引用了我公司使用的几个私有pod.其中一个称为DKKit的pod依赖于另一个我称为BaseProKit的私有pod.BaseProKit包含3个框架,它在其头部和实现文件中引用,我认为这些框架被认为是vendored_frameworks.在BaseProKit的现有头文件中,通过导入引用了这些框架,这些框架#import <PPCommon/PPCommon>在编译时工作得很好(通常),而仅依赖于BaseProKit pod.但是,当包含DKKit时,DKKit会在导入BaseProKit.h包含上述导入的导入时查找标题别名.然而,在DKKit的上下文中,似乎DKKit pod不知道PPCommon框架的存在,并且它只看到它的头文件的别名通过Pods-BaseProKit引用.因此,任何和所有引用<PPCommon/ANYTHING>创建编译错误(未找到),以及我迄今为止唯一能够弄清楚的方法是只#import "PPCommon.h"需要通过引用来调整整个BaseProKit中的所有导入项目,这感觉不对.
我已经包含以下文件供参考:BaseProKit的Podspec:
s.name = "BaseProKit"
s.version = "1.0.5"
s.source_files = "BaseProKit/BaseProKit.h",
"BaseProKit/Data/*.{h,m}",
"BaseProKit/Sensor Calibration/*.{h,m}",
"BaseProKit/SP3D/BaseballSceneController/*.{h,m}",
"BaseProKit/SP3D/SceneElements/*.{h,m,hpp,cpp}",
"BaseProKit/SP3D/SceneEnvironment/*.{h,m}",
"BaseProKit/Third Party/DeviceModelDetector.{h,m}",
"BaseProKit/Third Party/SkyProKitEmptyMMFile.{h,mm}"
s.resources = "BaseProKit/SatelliteLibrary/SatelliteLibrary.bundle","BaseProKit/SP3D/SP3DResources.bundle", "BaseProKit/SP3D/Models/Vertex Data/*"
s.frameworks = "GLKit", "OpenGLES", "Foundation", "UIKit", "Accelerate", "PPCommon", "SatelliteLibrary", "SP3D"
s.library = 'c++'
s.prefix_header_file = "BaseProKit/BaseProKit-Prefix.pch"
# s.public_header_files = "BaseProKit/PPCommon/PPCommon.framework/Headers/*.h", "BaseProKit/SatelliteLibrary/SatelliteLibrary.framework/Headers/*.h", "BaseProKit/SP3D/SP3D.framework/Headers/*.h"
s.vendored_frameworks = "BaseProKit/PPCommon/PPCommon.framework",
"BaseProKit/SatelliteLibrary/SatelliteLibrary.framework",
"BaseProKit/SP3D/SP3D.framework"
Run Code Online (Sandbox Code Playgroud)
DKKit的Podspec:
s.name = "DKKit"
s.version = "1.0.0"
s.source_files = 'DKKit/**/*.{h,m}'
s.resources = 'DKKit/**/*.xcdatamodeld' …Run Code Online (Sandbox Code Playgroud) 可以使用Objective-C++框架包装C++代码,以便在Swift代码中使用,包括Playground环境.我的一些框架包括OpenCV库,这在Swift正确包装时效果很好.不幸的是,由于以下错误,我无法在游乐场中使用这些:
Playground execution failed: error: Couldn't lookup symbols: _OBJC_CLASS_$_MyClass
Run Code Online (Sandbox Code Playgroud)
... 我的框架MyClass的子类在哪里NSObject.实际上,在链接到其中一个OpenCV库之后,没有框架符号可用于游乐场(例如,-lopencv_core在构建设置中添加到"其他链接器标志"之后),这些符号是否与OpenCV(或C++)有关.那件事).
我非常喜欢在导入框架的上下文中在游乐场中开发一些小功能,成功的解决方案最终将最终结束.同样,OpenCV对我来说是一个重要的图书馆,因此必须在游乐场玩它才能解放(更不用说有趣)了.
我还在使用Swift 1.2(OS 10.10.4),因为我即将向App Store提交更新,但如果Swift 2在这方面有任何改变,我会感兴趣.至于OpenCV,这是3.0.0版本,使用CMake和默认配置构建.
编辑:刚刚在Apple的论坛中发现了这个问题(比我更好,更普遍):https://forums.developer.apple.com/thread/6246
objective-c++ ×10
objective-c ×5
c++ ×3
c ×2
frameworks ×2
ios ×2
ipad ×2
iphone ×2
xcode ×2
avfoundation ×1
bitmask ×1
cocoa ×1
cocoapods ×1
debugging ×1
function ×1
gcc ×1
linker ×1
opencv ×1
view ×1