我正在使用FCM我的项目.它有一个类型的丰富推送通知.我试图修改大多数可能的方法来推动FCM.我得到了普通的推动FCM,而不是图像.
我也使用push try检查APNS相同的编码.我得到了推送通知的预期设计.
我的APNS有效载荷
{
"aps": {
"alert": "Enter your message",
"badge": 1,
"sound": "default",
"content-available": 1,
"mutable-content": 1
},
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
}
Run Code Online (Sandbox Code Playgroud)
这里FCM的有效载荷
{
"to": "dWB537Nz1GA:APA91bHIjJ5....",
"data":
{
"message": "Offer!",
"mediaUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2a/FloorGoban.JPG/1024px-FloorGoban.JPG"
},
"notification":
{
"body": "Enter your message",
"sound": "default",
"content-available": 1,
"mutable-content": 1
}
}
Run Code Online (Sandbox Code Playgroud)
另外,我需要更多关于FCM中有效载荷的详细信息
我错过了基本控制台中的任何设置,还是来自有效负载的设置.
push-notification apple-push-notifications ios firebase firebase-cloud-messaging
这是我使用Swift语言的第一个框架,它是私有框架.在新的Xcode 9.3发布之前,它的工作正常.升级后更新Xcode得到了这样的问题Module compiled with Swift 4.0.3 cannot be imported in Swift 4.1.
之后我才意识到框架不支持自动版本(Xcode/Swift)升级,有些搜索发现有一个Universal or Fat Binary Framework单独的构建,而不是我之前错过的真实设备和模拟器的单独构建.
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# Make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Next, work out if we're in SIM or DEVICE
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
# Step 2. Copy the framework structure (from iphoneos build) to the …Run Code Online (Sandbox Code Playgroud) xcode backwards-compatibility version-compatibility swift swift-framework
我试图更改标签的字体,但它不起作用字体名称:新的新旧金山.
将该字体导入项目并添加到info.plist中,这是我的代码
labelname.font = [UIFont fontWithName:@"SF UI Text-Light" size:12];
Run Code Online (Sandbox Code Playgroud)
如果我使用它的工作正常
labelname.font = [UIFont fontWithName:@"HelveticaNeue" size:12];
Run Code Online (Sandbox Code Playgroud)
但新旧金山字体不起作用.我不知道我错过了什么:(
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
@synchronized (session)
{
[[session downloadTaskWithURL:attachmentURL
completionHandler:^(NSURL *temporaryFileLocation, NSURLResponse *response, NSError *error) {
if (error != nil) {
NSLog(@"error.localizedDescription %@", error.localizedDescription);
} else {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path stringByAppendingString:fileExt]];
[fileManager moveItemAtURL:temporaryFileLocation toURL:localURL error:&error];
NSError *attachmentError = nil;
attachment = [UNNotificationAttachment attachmentWithIdentifier:@"" URL:localURL options:nil error:&attachmentError];
if (attachmentError) {
NSLog(@"attachmentError.localizedDescription %@", attachmentError.localizedDescription);
}
}
completionHandler(attachment);
}] resume];
}
Run Code Online (Sandbox Code Playgroud)
我正在使用FCM进行推送通知.
{
"to": "ffHjl2CblrI...",
"data": {
"message": "Offer!",
"image": "https://media.giphy.com/media/l4lR0Q5u91kTNJPsA/giphy.gif",
"url": custom url, …Run Code Online (Sandbox Code Playgroud) ios firebase nsurlsession nsurlsessiondownloadtask unnotificationattachment
view和viewcontroller是分开的.我已经尝试过NSUserDefaults它不起作用了.
[[NSUserDefaults standardUserDefaults] setValue:BOOLCondition forKey:@"YES"];
[[NSUserDefaults standardUserDefaults] synchronize];
Run Code Online (Sandbox Code Playgroud)
它表示bool到id的影响转换不允许使用arc
如何传递bool值
*****查看viewcontroller而不是viewcontroller到viewcontroller
ios ×4
xcode ×3
firebase ×2
objective-c ×2
fonts ×1
iphone ×1
nsurlsession ×1
swift ×1
uilabel ×1