在我的一个视图中,我只想在UIWebView中显示pdf文件.
我的头文件代码:
#import <UIKit/UIKit.h>
@interface FCOMViewController : UIViewController
{IBOutlet UIWebView *fcomWebView;}
//flag to denote if this is first time the app is run
@property (nonatomic) BOOL firstRun;
@end
Run Code Online (Sandbox Code Playgroud)
这里是实现文件中的方法:
- (void)viewDidLoad {
//Show the procedures PDF
NSString *path = [[NSBundle mainBundle] pathForResource:@"b777normalprocedures" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[fcomWebView loadRequest:request];
[fcomWebView setScalesPageToFit:YES];
Run Code Online (Sandbox Code Playgroud)
该应用程序启动正常,不崩溃或任何东西.引用出口已设置,但不显示PDF.控制台说:
DiskImageCache:无法解析旧目录的绝对路径.找不到PDF标题:找不到`%PDF'.
pdf在项目目录中,我已经仔细检查过它是否正确写入.
我能在这做什么?任何帮助,将不胜感激.
我是iPhone开发新手,但设法在我的iOS应用程序中接收推送通知.但是,当我轻扫传入的推送通知时,它只会打开应用程序,但不会打开通知的相关帖子.
这是我的代码:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
NSLog(@"Eine Nachricht ist angekommen, während die App aktiv ist");
NSString* alert = [[userInfo objectForKey:@"aps"] objectForKey:@"id"];
NSLog(@"Nachricht: %@", alert);
//This is to inform about new messages when the app is active
//UIApplicationState state = [[UIApplication sharedApplication] applicationState];
//if (state == UIApplicationStateActive) {
// UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Neuer Artikel" message:@"Nachricht" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
// [alertView show];
// }
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"Device Token=%@", deviceToken);
NSUInteger theCount = [deviceToken length]; …Run Code Online (Sandbox Code Playgroud)